0
votes

In my Android Wear app:

I make a call to get my Authorization Code:

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]

Then I authorize the app on my phone. I make a POST call to get my tokens (access & refresh):

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

I then receive the response:

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

I included the parameter access_type=offline in my initial code request. Why am I not getting the refresh token? I tried in OAuth2.0 Playground and added the redirect_uri "https://developers.google.com/oauthplayground" to my project in the developer console, and I am able to receive it there. What's the difference and how can I fix this? Thanks in advance.

1

1 Answers

0
votes

Resolution

Went to https://myaccount.google.com/permissions and removed my app's permissions from my account. Tried the request again and I received my refresh token.