2021年1月18日星期一

Android One Tap SignIn, nonce is missing from the generated ID Token

According to the documentation https://developers.google.com/android/reference/com/google/android/gms/auth/api/identity/BeginSignInRequest.GoogleIdTokenRequestOptions.Builder#setNonce(java.lang.String)

I expect the nonce will be included as a claim from the IDToken, however, after setting the nonce with the following code:

      oneTapClient = Identity.getSignInClient(getContext());          BeginSignInRequest signInRequest = BeginSignInRequest.builder()                  .setGoogleIdTokenRequestOptions(BeginSignInRequest.GoogleIdTokenRequestOptions.builder()                          .setSupported(true)                          .setServerClientId(clientId)                          .setNonce("5qb6kvo0q8drrzs50dkv5uzci1ft7p1")                          .setFilterByAuthorizedAccounts(false)                          .build())                  .build();  

and get the id token from:

SignInCredential credential = null;              try {                  credential = oneTapClient.getSignInCredentialFromIntent(data);                  String idToken = credential.getGoogleIdToken();                               } catch (ApiException e) {                 ...              }  

Decode the returned idToken, the nonce is missing.

Is it a defect? or did I miss something?

https://stackoverflow.com/questions/65784580/android-one-tap-signin-nonce-is-missing-from-the-generated-id-token January 19, 2021 at 10:05AM

没有评论:

发表评论