Search code examples
androidfirebasegmailgmail-apigoogle-developers-console

Integrating gmail connection in Firebase project


I developped an application that uses gmail api to get all the mails from the user. Then I divided this app in a sample (almost empty) and a fragment that does everything, so I can later integrate my fragment easily in my team's project's settings.

Now that my fragment is in the other project, the gmail connexion doesn't work and gives me these errors :

E/Async Task: com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAuthIOException
E/Google log in: failed

I think this error is because the project uses firebase and already have a google-services.json file and mine isn't used. We added the GMail API in the google developper portal and generated a new json file but it doesn't seem to work.

Why does my GMail connexion fails and how can I solve it ?


Solution

  • Ok, I managed to get it working.

    Looks like when I create credentials keys in the API manager Google console, it doesn't add the SHA1 keys in all the apps of the project in Firebase.

    All I had to do (after a week of hard work) was to copy paste the SHA1 from tha app "linked" to the Google API console in the other app

    I hope it can help