“An internal error occurred” with integration of Google Plus Login

我只是一个虾纸丫 提交于 2020-01-08 12:24:05

问题


I am trying to integrate a Google plus Login in my application as per the instruction provided by following link : https://developers.google.com/+/quickstart/android#install-sdk

I am following all the instructions perfectly. And when I run the sample application on a real device provided in the android-sdk and click the signin button, it display a Toast message that An internal error occurred

What am I doing wrong?


回答1:


This can happen when you haven't set the signature for the client ID in your API console project, or if you copied the wrong key value from keytool. Doing so is documented in the steps of the quick start guide on steps 7, 8, 9, and 10.




回答2:


I have this problem and even after creating 10 different client IDs with different SHA and package name, it doesn't work... until I found out that you have to fill the Consent screen.

According to GoogleDevelopers Console -

The consent screen will be shown to users whenever you request access to their private data using your client ID.




回答3:


I've solved problem by removing .setScopes("PLUS_LOGIN") in the PlusClient.Builder.




回答4:


I got this toast message error in my android application:

An internal error occurred

Summary:

Assuming you made a mistake configuring the negotiation between your android app and the Android API server granting you access. Most likely caused by you not adding the correct package name or correct SHA1 fingerprint. I followed these steps to blow out the wrong configuration and do it right.

Steps to fix:

  1. Go to your google api console and login: https://code.google.com/apis/console

  2. Click "API Access" tab.

  3. Click the button: "Create another client ID".

  4. Choose: "Installed Application" radio button.

  5. Choose: "Android" radio button.

  6. Enter the package name of the android app that is displaying the above error. You can find it defined at the top of the PlusSampleActivity.java code file. For me it is com.google.android.gms.samples.plus

  7. Acquire your SHA1 fingerprint value:

    a. Use the command keytool -list -v -keystore /home/el/.android/debug.keystore. Enter password, If you never set it, the default password is 'android'.

    b. The SHA1 fingerprint is shown on screen, copy that.

  8. Paste the above value into the "Signing certificate fingerprint (SHA1):" box.

  9. Click the button: "Create client ID".

  10. Run your android application again, click "Sign in".

Now you are presented with an Activity to "Sign in to Google+ SDK with Google".




回答5:


In my case, the solution was to actually set an email address in the Consent Screen. First, I was a bit reluctant to select my personal address and for an strange reason you can save the form without this piece of data with no error. After checking what others have suggested, as soon as I set my email address in that form, it started working.




回答6:


I have been searching how to fix this for a day with full of research without luck finally i managed to resolve this issue with the following approach.

Before i begin resolving this (at least how ti worked for me) i have to say that everything on the documentation is correct and you don't have to change any lines of code or so. It looks like more of a bug in the https://cloud.google.com/console cloud console

First ensure you got the correct SHA1 and your project's package name as described in the docs https://developers.google.com/+/quickstart/android

Now this bug as i noticed (at least for me) was that in my cloud console, the project i have created was long ago with the old interface and few months ago i migrated to the new GUI.Once you get the new look on cloud console you will notice that new projects have an auto generated project id like this atlantean-ares-331 while old projects got a long integer value as project id which is not visible. So if your project was created with the old GUI and you have just created new client id for OAuth for that project you will get the Toast "An internal error occurred” while trying to sign in with google.

How to Fix

  1. Go to your cloud console
  2. Make a new project i would suggest a name like oldprojectname-gplus
  3. In APIs section enable Google+ API
  4. Ensure that none of your projects has the same package name on OAuth Client ID with the one you will use now otherwise you will get Error This client ID is globally unique and is already in use.(you will have to delete the old OAuth client id with the same package name you will use now).

  5. Go to Credentials Create New Client ID for OAuth.

Installed application

Android

Enter your project's package name and your SHA1

Done




回答7:


My solution to the problem was following.

I did everything others recommended and there was no typo regarding the package name and SHA1 key. I also tried removing the key and then adding it again but it didn't help.

What did help is removing the key and creating a new project (at https://code.google.com/apis/console) and then creating the Client ID (with package+sha1) again there. After that (5 secs) everything worked on my Android device.




回答8:


This problem is related to the permissions from the api console.

if you are using a permission related with SCOPE_PLUS_LOGIN, in the api console you must create two keys, one for OAuth client id, and other for public api key.




回答9:


In my case the problem was that I changed the package name of the app and didn't update in dev console.




回答10:


For me it was that i was attempting to use my production key when installing it using my debug key. Make sure your using the right SHA1 from the right keystore.




回答11:


I turned around to the Google IO 2013, and changed the initialization of PlusClient, then it works.

public static final String AUTH_SCOPES[] = {
    Scopes.PLUS_LOGIN,
    "https://www.googleapis.com/auth/userinfo.email",
    "https://www.googleapis.com/auth/developerssite" };

mPlusClient = new PlusClient.Builder(this, this, this)
    .setScopes(AUTH_SCOPES)
    .build();



回答12:


Thanks Thano for the solution "Now this bug as i noticed (at least for me) was that in my cloud console, the project i have created was long ago with the old interface and few months ago i migrated to the new GUI.Once you get the new look on cloud console you will notice that new projects have an auto generated project id like this atlantean-ares-331 while old projects got a long integer value as project id which is not visible. So if your project was created with the old GUI and you have just created new client id for OAuth for that project you will get the Toast "An internal error occurred” while trying to sign in with google."




回答13:


Recreating the project in the Google Console worked for me after several other attempts:

For any reason my project did not have a project ID (old console/new console?).

As Thano (above) suggested, I created a brand new project, created Client IDs, ... and then in worked. Thanks for the advice!!




回答14:


Remember to use the built-in debug keystore for testing. I had everything else working correctly, but I had set my production keystore SHA1 fingerprint in the Credentials in the Developers Console, which caused it not to work.




回答15:


If your facing this error when you try to run the sample application "or" copy the project which you have created in other machine which was running successfully in that and giving such pop-up error in the other machine where you are trying to run ,you can follow the below method and it will help.

If your are building the app for testing/debug purpose then,

1.Generate the new SHA1 if you copy your project and run it on other machine for the package name and path provided for keystore.

2.Change the ClientId in developers console for new generated SHA1 and run it in the new machine where you have copied the project and trying to run it.




回答16:


Something often overlooked is the package name. I'd like to clarify the step 6 by Eric Leschinski above (can't comment there): the required package is not the package of an activity, rather the package of your app's manifest.

You may retrieve the correct value from the root element of AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ntk.darkmoor"
    android:versionCode="1"
    android:versionName="1.0" >

In this example define "com.ntk.darkmoor" while creating the Client ID




回答17:


I had the same issue when I used SHA1 for debug.keystore for debuging then exported my application forgetting to generate SHA1 for keystore that I used to export my application.




回答18:


Its working for me when i connect the device and install the apk from Android Studio. But its now working for me when i generate the .apk and install it from dropbox.




回答19:


I went through all the answers provided here and others as well. In my case the issue was the SHA-1 as well. The reason I was getting the incorrect SHA-1 was my keytool export cert command.

Previously I was using

C:\Users\mysuername\.android SHA 1 signature keytool -exportcert -alias androiddebugkey -keystore "keystorepath" -list -v

The problem was in the androiddebugkey variable. Here you have to give the name of the key you use for signing the application.

C:\Users\mysuername\.android SHA 1 signature keytool -exportcert -alias mykeyname -keystore "keystorepath" -list -v

Hope this helps someone!




回答20:


To add to this long list of reasons my problem was that i got the debugkey from the jks file rather than the app.

Its always something small.



来源:https://stackoverflow.com/questions/15762904/an-internal-error-occurred-with-integration-of-google-plus-login

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!