Search code examples
androidauthenticationfirebaseandroid-studio-2.0

An OAuth2 client already exists for this package name and SHA-1 in another project


I was practicing firebase CodeLab (Friendly Chat) for learning firebase with android. In that tutorials ,I made a project on firebase console named as "Friendly Chat" and then I add my android app package name and SHA-1 so that invites and Google Auth could be work. After that tutorial get compeleted, I got firebase Auth demo project from github.I add auth demo project's package name and SHA-1 in same console project "Friendly Chat",its mean now console project "Friendly Chat" have two android apps.Then I downlaoded google.services.json file of Auth project and when I run project in Android Studio,Auth demo did not work as it keep showing loading progress Dialog.I thought it may be because I added two android apps in same console project so,I delete auth app from Friendly Chat console project and made another project on firebase console named as "Project Auth" and I add package name of Auth demo android project (which I downloaded from firebase github repository) but when I tried to add SHA-1 copied from "Friendly Chat" console project,it gives me below error

"An OAuth2 client already exists for this package name and SHA-1 in another project"

why Im getting this error even I have deleted Auth app package name and SHA-1 from other console project.


Solution

  • So the answer is well written in the error. You can't have two projects of same package name. Even if you delete it. It will take alteast 4-5 days to get deleted fully from developer's console.

    So only solution is to generate a new SHA-1 key by custom signing the app by generating a signed apk from android studio. Or just create a new project with different package name both ways will work for now.

    Hope this info helps. Do let me know if it changes anything for you.

    EDIT: I encourage you to go through these official Google docs on signing apk to understand this process.