Android: How to get Refresh Token by Google Sign-In API?

前端 未结 2 852
萌比男神i
萌比男神i 2020-12-29 08:05

Currently, I am working on the application where user able to login with Google. As part of the login process, we need to send Google ACCESS TOKEN and REFRESH TOKEN to serve

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-29 08:37

    You should use the server auth code flow via Auth.GOOGLE_SIGN_IN_API: get an server auth code on Android client, send to your server, server exchanges the code for refresh and access token (with a secret). There are more details in this blog post as well.

    Also, if you are using GoogleAuthUtil.getToken for access token now, you do want to check out this Google Sign-In best practice blog post to see how to migrate to the recommended flow to ensure security and best UX.

提交回复
热议问题