Error 12501 authenticating with google sign-in

后端 未结 12 1939
我在风中等你
我在风中等你 2020-11-28 13:12

I\'m using google sign-in services to authenticate users that use my app. I got it to work when I just requested email information

GoogleSignInOptions gso =          


        
相关标签:
12条回答
  • 2020-11-28 13:43

    In my project I had a different applicationId in my gradle file than packagename in my manifest.xml and that was the source of my problem.

    The android key I had to created needed to have the applicationId fqdn and NOT the package name (contrary to what google tells you) for it to work for me.

    Thought I'd leave that here in case it saves time to someone.

    0 讨论(0)
  • 2020-11-28 13:43

    Hi I have seen above comments but as I have done practical , its all sha issue , means if you will register the sha of particular ip address and get google.services json , that will perfect either you can use

       gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestEmail()
                .build();
    

    or gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(LoginActivity.this.getResources().getString(R.string.server_client_id)) .requestEmail().build(); but if you want to create app on other ip address with other machine sha is showing you 12501 error status code so for that you need to generate again sha for that particular machine . Thanks

    0 讨论(0)
  • 2020-11-28 13:45

    I experienced a similar problem. In my case, it was because the server client ID that I was using was from a different project than the client keys. It turns out that they need to be from the same project.

    0 讨论(0)
  • 2020-11-28 13:48

    Have you already set up your signingConfigs and buildTypes in your Gradle? I've fixed it by explicitly specify those things on gradle. Read here http://developer.android.com/tools/publishing/app-signing.html

    0 讨论(0)
  • 2020-11-28 13:50

    Well, this is very embarrassing, but I figured it out:

    GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                        .requestIdToken(AuthenticatedActivity.this.getResources().getString(R.string.server_client_id))
                        .requestEmail().build();
    

    I was sending it the resource ID instead of dereferenced string resource.

    0 讨论(0)
  • 2020-11-28 13:50

    I had this issue when I accidentally used the client ID of the Android app instead of the Webapp as the requestIdToken() parameter.

    You should use the Client ID of the Webapp there. By default it is called Web client (auto created by Google Service)

    0 讨论(0)
提交回复
热议问题