<p>Hello all! </p>
<p>I am writing the server side of an iPhone app in Go, I am really enjoying the language so far, but was wondering if someone could point me in the right direction... </p>
<p>I am trying to process a token from the Google ID APIs (on phone, user clicks "login with google", and I get a token on the server). I have already implemented the Google signature check manually, but was looking to see if there were any packages to turn the text token into a meaningful struct? </p>
<p>I know about goth and authboss, but those don't seem to apply to me since the auth will happen on the phone via the Google APIs, the server simply gets a token. (I could be wrong about this) </p>
<p>Any help is much appreciated! Thanks! :-) </p>
<hr/>**评论:**<br/><br/>bradfitz: <pre><p>Do either <a href="http://godoc.org/golang.org/x/oauth2/google" rel="nofollow">http://godoc.org/golang.org/x/oauth2/google</a> or <a href="http://godoc.org/golang.org/x/oauth2/jwt" rel="nofollow">http://godoc.org/golang.org/x/oauth2/jwt</a> help?</p></pre>Kazbin: <pre><p>I'd say you should take a look at the <a href="https://github.com/stretchr/gomniauth" rel="nofollow">gomniauth</a> package. It should do just what you are trying to do. As it accepts the token via the callback URL which you give to Google. It automatically processes it into an object which you then can use.<br/>
It's really nice and simple to implement.</p></pre>AustinDizzy: <pre><p>I have <a href="https://github.com/AustinDizzy/prtstatus-go" rel="nofollow">a project</a> which deals with the same OAuth 2.0 tokens and I simply use <code>code.google.com/p/goauth2/oauth</code> for interacting with the OAuth server and I store the <a href="http://godoc.org/code.google.com/p/goauth2/oauth#Token" rel="nofollow">oauth.Token</a> directly into my db. The package handles the rest of automatically renewing the refresh token, signature, scope, bleh bleh nonsense.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传