'"Authorization not granted" error in Flutter app for Google Fitness

I browsed the Web for tutorials on how to use health package and Google Fitness API in a flutter app. I gathered the steps according to my understanding:

  1. Create a flutter app based on example given here
  2. Add health package 3.4.4 to the flutter app
  3. Create Client ID and OAuth consent screen through Google Cloud Console for this app.
  4. Generate keystore through Android Studio and get the SHA1 fingerprint and add it in the Cloud Console during Step 3 above.
  5. Add test users in Cloud Console.
  6. Download the JSON file generated by the Console. Here, I m a little confused. What is the exact location in the project structure to place the JSON file? I have currently placed it under projectname\android\app folder.
  7. Manifest file contains appropriate permissions and build.gradle has all the required lines.
  8. When I run the app, I get the main screen and am shown a prompt to login to the Google id, but after logging in, nothing happens and I get "Authorization not granted" error.

I checked all similar questions here on Stackoverflow but none of the answers have helped. I checked various other resources across the Web, nothing has helped.

Things I have not done yet for the app: a) Verification on Google Cloud console (Since I m just experimenting and testing yet, I have not submitted the app for verification, also I have no domain name) b) No Firebase integration as yet (is this mandatory?)

What other things can I try?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source