Skip to content Skip to sidebar Skip to footer

Why Does Google+ Login Accomplish Login With An Error?

I've been dealing with Google+ login on android lately, and one thing keeps bugging me. In all of their officially sanctioned examples, there isn't a method that specifically show

Solution 1:

The reason is that that the device can't know whether you actually need to log in or not - sign in is really more like accessing a facility (as you might with location) than it is entering a username and password. The basic flow is:

  1. Connect to Google Play services, see if the app has been authorised.
  2. If it has, the connection succeeds.
  3. If not, the connection fails.

If you then want to log in, you go through the connection result resolution.

The subtle thing is that you may go to step 2 even if the user has never used the app on the device before! So, for example, if I go to your website and sign in there, then install your android app.

  1. The app starts, and retrieves a list of your user accounts (via the GET_ACCOUNTS permission)
  2. It tries to connect to Google Play services with any of the accounts
  3. Google Play services calls out to the Google auth servers, finds out you have already signed in to that application (in this case, on the web)
  4. The app gets the onConnected callback

So the reason that there is no login method is that the login status is actually remote - it lives on the Google servers, not on the device itself. The flow therefore has to be asynchronous.


Solution 2:

I am aware that this thread is very old. Updating as this comes up every time on Google. Now that google play store API v 8.4 is released, onConnectionFailed does exactly what it has to do.

Check this link https://github.com/googlesamples/google-services/blob/master/android/signin/app/src/main/java/com/google/samples/quickstart/signin/SignInActivity.java


Solution 3:

Here is pretty normal example https://developers.google.com/+/mobile/android/sign-in:

There is method

`@Override
public void onConnected(Bundle connectionHint) {
  mSignInClicked = false;
  Toast.makeText(this, "User is connected!", Toast.LENGTH_LONG).show();
}`

first steps are there https://developers.google.com/+/mobile/android/getting-started


Post a Comment for "Why Does Google+ Login Accomplish Login With An Error?"