Send feedback
Getting profile information
Stay organized with collections
Save and categorize content based on your preferences.
outlined_flag
Support for the Google Sign-In library is deprecated.
Use ID tokens to securely communicate the currently signed in user to your backend server, not Google IDs or profile information.
The getBasicProfile() method allows retrieval of a user's basic profile information such as ID, name, profile URL, and email address after signing in.
Use the account's ID to identify a user, not their email address, as email addresses can change.
Warning: The Google Sign-In library optionally uses FedCM APIs,
and their use will become a requirement.
Conduct an impact assessment
to confirm that user sign-in continues to function as expected.
Support for the Google Sign-In library is deprecated, see the
Deprecation and Sunset guide for more.
After you have signed in a user with Google using the default scopes, you can
access the user's Google ID, name, profile URL, and email address.
Important: Do not use the Google IDs returned by getId() or the user's
profile information to communicate the currently signed in user to your backend server.
Instead, send ID tokens , which can be securely validated
on the server.
To retrieve profile information for a user, use the getBasicProfile()
method. For example:
// auth2 is initialized with gapi . auth2 . init () and a user is signed in .
if ( auth2 . isSignedIn . get ()) {
var profile = auth2 . currentUser . get () . getBasicProfile ();
console . log ( 'ID: ' + profile . getId ());
console . log ( 'Full Name: ' + profile . getName ());
console . log ( 'Given Name: ' + profile . getGivenName ());
console . log ( 'Family Name: ' + profile . getFamilyName ());
console . log ( 'Image URL: ' + profile . getImageUrl ());
console . log ( 'Email: ' + profile . getEmail ());
}
Note: A Google account's email address can change, so don't use it to identify
a user. Instead, use the account's ID, which you can get on the client with
getBasicProfile().getId(), and on the backend from the sub claim of the ID
token.
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-06 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-06 UTC."],[],[]]