Why does Google Sign-In for Android return a "sub" user identifier that differs from UserService.getCurrentUser() for hosted domain accounts?

Viewed 202

For Google Accounts that are NOT hosted domain accounts, the sub user identifier returned by https://developers.google.com/identity/sign-in/android/backend-auth always matches the response from UserService.getCurrentUser().getUserId() as expected.

However for hosted domain accounts, the sub identifier doesn't match the response from UserService.getCurrentUser().getUserId(). How can we have a common user identifier for hosted domain accounts, regardless of whether the user signs in using Google Sign-In for Android Id Token or via the server-side UserService browser sign-in?

1 Answers
Related