Authentication

We cannot obtain a refresh_token through the access_token generated by our Flutter app. When attempting to generate a refresh_token using this access_token, we receive the message ‘unauthorized.’

2 Likes

Hi @bcoder ,

Welcome to the Google Cloud Community!

There are many reasons why you might be receiving the “Unauthorized” error. It’s difficult to debug without seeing your entire code, particularly the parts where you generate and access the tokens. Here are some pointers:

  • Check Client ID and Secret: You’ll want to double-check the client ID and the secret key you’re using for generating the refresh token. They should be the same ones you have for your Flutter app in Google Cloud. If they don’t match, that’s probably why things are going sideways with the authorization.
  • Look at Your Scopes: Have a look at the scopes you’re asking for when you’re trying to get that refresh token. They need to be the same as the ones you used originally for the access token. If there’s even a small mix-up or something’s missing in those scopes, it can throw a wrench in the whole authorization process.

Here are some StackOverflow threads that might give you an idea on how to troubleshoot your issue:

I hope this helps. Thank you.

1 Like