identity-samples icon indicating copy to clipboard operation
identity-samples copied to clipboard

CredentialsQuickstart does not trigger signin when no user credential exists

Open joshzhao opened this issue 4 years ago • 0 comments

When the demo app starts, obviously there is no user logged in yet. "Load credential" actually leads to an error message in the console: "Credential does not contain ID Tokens" when I choose a Google account from the credential selection UI. I believe that a login should be triggered instead.

I think I actually found where the bug is. The following code segments have their orders reversed in requestCredentials():

                   if (e instanceof ResolvableApiException) {
                        ... ...
                        resolveResult(rae, RC_READ);
                        return;
                    }

                    if (e instanceof ApiException) {
                        ApiException ae = (ApiException) e;
                        if (ae.getStatusCode() == CommonStatusCodes.SIGN_IN_REQUIRED) {
                            // This means only a hint is available, but we are handling that
                            // elsewhere so no need to act here.
                        } else {
                            Log.w(TAG, "Unexpected status code: " + ae.getStatusCode());
                        }
                    }

SIGN_IN_REQUIRED does not seem to be handled anywhere else. Here it is just preempted and will never be executed.

I am surprised that no one seems to be complaining about this issue. Is this code been actively worked on? Does anyone else have the same issue?

Thanks, Joshua

joshzhao avatar Jul 01 '21 23:07 joshzhao