We are discontinuing the Google Sign-In JavaScript Platform Library for web. The library will be unavailable for download after the March 31, 2023 deprecation date. Instead, use the new Google Identity Services for Web.
By default, newly created Client IDs are now blocked from using the older Platform Library, existing Client IDs are unaffected. New Client IDs created before July 29th, 2022 can set `plugin_name` to enable use of the Google Platform Library.

Getting Profile Information

Stay organized with collections Save and categorize content based on your preferences.

After you have signed in a user with Google, if you configured Google Sign-In, with the DEFAULT_SIGN_IN parameter or the requestProfile method, you can access the user's basic profile information. If you configured Google Sign-In with the requestEmail method, you can also get their email address.

Before you begin

Retrieve profile information for a signed-in user

Use the GoogleSignIn.getLastSignedInAccount method to request profile information for the currently signed in user.

GoogleSignInAccount acct = GoogleSignIn.getLastSignedInAccount(getActivity());
if (acct != null) {
  String personName = acct.getDisplayName();
  String personGivenName = acct.getGivenName();
  String personFamilyName = acct.getFamilyName();
  String personEmail = acct.getEmail();
  String personId = acct.getId();
  Uri personPhoto = acct.getPhotoUrl();

For additional profile data that might be available, see GoogleSignInAccount. Note that any of the profile fields can be null, depending on which scopes you requested and what information the user's profile includes.