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.

Facebook uses OAuth 2 - You'll need to use goauth2 to authenticate.

Twitter uses: OAuth. You'll need to use goauth to authenticate.

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.

I'm also working on a solution to this problem in the HAL/auth package, but as of now it's incomplete. Here's how HAL handles app engine openid.

Need Your Help

alert other threads of event/action

java multithreading sockets

I have a server/client application that uses a number of threads to handle various aspects of the system. A new thread is created in a ClientHandler object that manages communications between the s...