douzhi9635
2016-10-26 02:06
浏览 116

如何通过后端集成设置iOS Google登录?

I'm trying to follow the instructions at: https://developers.google.com/identity/sign-in/ios/offline-access. Whenever I send a token I get: "redirect_uri_mismatch".

I read in another question that client ids need to wait for a bit. This is not the case. The backend id has been active since August. The web app works fine. The server json sets "redirect_uris" to "postmessage".

This looks very similar to the question: Cross-platform Google OAuth Signin: redirect_uri mismatch but my scenario is with iOS and Go.

If I add a scope "audience:server:client_id:" as suggested by https://developers.google.com/identity/protocols/CrossClientAuth I get an "invalid scope" error.

图片转代码服务由CSDN问答提供 功能建议

我正在尝试按照以下说明进行操作: https://developers.google.com/identity/sign-in/ios/offline-access 。 每当我发送令牌时,都会得到:“ redirect_uri_mismatch”。

我读到另一个问题,即客户机ID需要稍等片刻。 不是这种情况。 后端ID自8月以来一直处于活动状态。 网路应用程式运作良好。 服务器json将“ redirect_uris”设置为“ postmessage”。

这与问题非常相似:跨平台Google OAuth登录:redirect_uri不匹配,但是我的情况是使用iOS和Go。

如果我 根据 https://developers.google的建议,添加范围“ audience:server:client_id:”。 com / identity / protocols / CrossClientAuth 我收到“无效范围”错误。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongyigua4468 2016-11-15 02:56
    已采纳

    I found the way.

    First, forget about "audience:server:client_id:".

        let signin = GIDSignIn.sharedInstance()
        signin.clientID = "XXXX-YYYY.apps.googleusercontent.com"
        signin.serverClientID = "XXXX-ZZZZ.apps.googleusercontent.com"
        signin.scopes.append("https://www.googleapis.com/auth/plus.me")
        signin.delegate = self
    

    Second, redirect_uris don't matter.

    Last, the only thing else that you need to be careful is that serverAuthCode will only come once. So be sure to GIDSignIn.sharedInstance().signOut if you support log out.

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题