The*_*chu 3 openid google-app-engine login go federated-identity
我正在尝试使用Google App Engine Go SDK实现联合登录,但我能找到的关于如何在Python和Java中执行此操作的唯一示例.我知道我需要调用此函数来获取URL,但我不确定要传递的参数.有人可以在GAE Golang中提供几个主要平台(Facebook,Twitter等)的联合登录示例吗?
Facebook和Twitter不使用OpenID进行身份验证.
Facebook使用OAuth 2 - 您需要使用goauth2进行身份验证.
Twitter使用:OAuth.您需要使用goauth进行身份验证.
如果你仍然想要为Yahoo,Google,MySpace等提供商使用联合登录,它将如下所示:
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)
Run Code Online (Sandbox Code Playgroud)
对于Facebook和Twitter身份验证,您可以查看go.auth包.它可能不适用于App Engine,但它可能会给你一些线索.
我也在HAL/auth包中解决这个问题,但截至目前它还不完整.以下是HAL如何处理应用程序引擎openid.
| 归档时间: |
|
| 查看次数: |
2476 次 |
| 最近记录: |