首页 文章

Android Wear OAuth2.0未收到刷新令牌

提问于
浏览
0

在我的Android Wear应用中:

我打电话来获取我的授权码:

https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/books&access_type=offline&redirect_uri=https://www.android.com/wear/3p_auth/com.apps.greyrobe.wordrunner&response_type=code&client_id=[MY_CLIENT_ID]

然后我在手机上授权应用程序 . 我打了一个POST来获取我的令牌(访问和刷新):

https://www.googleapis.com/oauth2/v3/token?code=[MY_CODE]&client_id=[MY_CLIENT_ID]&client_secret=[MY_CLIENT_SECRET]&redirect_uri=https://www.android.com/wear/3p_auth/com.apps.greyrobe.wordrunner&grant_type=authorization_code

然后我收到回复:

{“access_token”:“[MY_ACCESS_TOKEN]”,“token_type”:“Bearer”,“expires_in”:3574}

我在初始代码请求中包含了参数access_type = offline . 为什么我没有获得刷新令牌?我尝试在OAuth2.0 Playground中将redirect_uri“https://developers.google.com/oauthplayground”添加到开发人员控制台中的项目中,我可以在那里收到它 . 有什么区别,我该如何解决这个问题?提前致谢 .

1 回答

相关问题