Golang GAE - Federated Login examples
I'm trying to implement Federated Login using Google App Engine Go SDK, but the only examples I can find on the subject are about how to do this in Python and Java. I understand that I need to call this function to get the URL, but I'm not sure about the parameters to pass. Can someone provide examples of Federated Login in GAE Golang for a few major platforms (Facebook, Twitter, etc)?
Facebook and Twitter don't use OpenID for authentication.
That said if you are still wanting to use Federated Login for providers like Yahoo, Google, MySpace it would look like this:
c := appengine.NewContext(r) // url is the OpenID url other possiblities include: // - yahoo.com // - myspace.com // - aol.com // - flickr.com/USERNAME url := "gmail.com" // redirectURL is where you want the User to be redirected to after login. redirectURL := "/callback" loginUrl, err := user.LoginURLFederated(c, redirectURL, url) // Then redirect the user to the url. http.Redirect(w, r, loginUrl, http.StatusFound)
For Facebook and Twitter authentication you might look at the go.auth package. It might not work with App Engine but it might give you some clues.