douzhi9635 2016-10-26 02:06
浏览 136
已采纳

如何通过后端集成设置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.

  • 写回答

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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题