As the title says i'm unable to refresh access token as it is giving me a unauthorized_client
error. This used to work perfectly a month ago but it doesn't work now.
Here's how i get the token:
My android app logins with the required scopes using consent screen and sends the tokens to my server
Then my django server saves them so that it can refresh the access token later.
creds = google.oauth2.credentials.Credentials(credentials.access_token,refresh_token=credentials.refresh_token,token_uri=token_uri,client_id=client_id_2,client_secret=client_secret,scopes=scopes)
This line loads values from the database and load them into Credentials
object.
Note:
- I have to
clientid's
, one for android and one for web client. - I refresh the tokens using the
clientid
available for web client
Issues:
- If i use the
clientid
of android, it throws an error ofinvalid_client
- If i use the
clientid
of web client, it saysunauthorized_client
Things that i've tried:
- Created another
clientid
- Checked for white spaces and other typos
- Changing settings of consent screen
- Adding a product to inapp purchases, as it seems not to work with other api before that.
Sample Code:
creds = google.oauth2.credentials.Credentials(credentials.access_token,refresh_token=credentials.refresh_token,token_uri=token_uri,client_id=client_id_2,client_secret=client_secret,scopes=scopes)
req = google.auth.transport.requests.Request()
creds.refresh(req)
EDIT: Found out that my quota has ran out. working on a different account fixed the issue.