Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Dopo aver eseguito l'accesso di un utente con Google, se hai configurato Accedi con Google, con il parametro DEFAULT_SIGN_IN o il metodo requestProfile puoi accedere alle informazioni di base del profilo dell'utente. Se hai configurato Accedi con Google
con il metodo requestEmail, puoi anche recuperare il suo indirizzo email.
Per ulteriori dati del profilo che potrebbero essere disponibili, consulta
GoogleSignInAccount.
Tieni presente che uno qualsiasi dei campi del profilo può essere null, a seconda degli ambiti
richiesti e delle informazioni incluse nel profilo dell'utente.
[null,null,["Ultimo aggiornamento 2025-08-31 UTC."],[[["\u003cp\u003eGoogle Sign-In for Android is outdated and developers should migrate to Credential Manager for enhanced security and user experience, except for Wear OS 3, 4, and 5.0 which requires continued use of Google Sign-In for Android until Credential Manager support is available.\u003c/p\u003e\n"],["\u003cp\u003eAfter signing in, developers can access basic user profile information, but are strongly advised against using email or user ID for backend server communication; instead, utilize user ID tokens or server auth code flow for security.\u003c/p\u003e\n"],["\u003cp\u003eTo get started, developers need to configure their Android Studio project and integrate Google Sign-In into their app before retrieving user profile data.\u003c/p\u003e\n"],["\u003cp\u003eUser profile information can be retrieved using \u003ccode\u003eGoogleSignIn.getLastSignedInAccount\u003c/code\u003e but email addresses should not be used for user identification due to potential changes, instead rely on the account's ID for consistent identification.\u003c/p\u003e\n"]]],[],null,["# Getting Profile Information\n\n| **Warning:** Google Sign-In for Android is outdated and no longer supported. To ensure the continued security and usability of your app, [migrate\n| to Credential Manager](https://developer.android.com/training/sign-in/credential-manager/) today. Credential Manager supports passkey, password, and federated identity authentication (such as Sign-in with Google), stronger security, and a more consistent user experience. For Wear developers: Credential Manager will be supported in Wear OS 5.1 and later on selected watches. Developers actively supporting Wear OS 3, 4 and 5.0 devices with Sign in with Google should continue using Google Sign-in for Android for your Wear applications. Sign in with Google support will be available on Credential Manager APIs for these versions of WearOS at a later date.\n\nAfter you have signed in a user with Google, if you [configured Google Sign-In](/identity/sign-in/android/legacy-sign-in#configure_google_sign-in_and_the_googlesigninclient_object),\nwith the `DEFAULT_SIGN_IN` parameter or the `requestProfile` method, you can\naccess the user's basic profile information. If you configured Google Sign-In\nwith the `requestEmail` method, you can also get their email address.\n| **Important:** Do not use a user's email address or user ID to communicate the currently signed-in user to your app's backend server. Instead, [send the user's\n| ID token to your backend server](/identity/sign-in/android/backend-auth) and validate the token on the server, or use the [server auth code flow](/identity/sign-in/android/offline-access).\n\nBefore you begin\n----------------\n\n- [Configure your Android Studio project](/identity/sign-in/android/legacy-start-integrating)\n- [Integrate Google Sign-In into your app](/identity/sign-in/android/legacy-sign-in)\n\nRetrieve profile information for a signed-in user\n-------------------------------------------------\n\nUse the `GoogleSignIn.getLastSignedInAccount` method to request profile\ninformation for the currently signed in user. \n\n GoogleSignInAccount acct = GoogleSignIn.getLastSignedInAccount(getActivity());\n if (acct != null) {\n String personName = acct.getDisplayName();\n String personGivenName = acct.getGivenName();\n String personFamilyName = acct.getFamilyName();\n String personEmail = acct.getEmail();\n String personId = acct.getId();\n Uri personPhoto = acct.getPhotoUrl();\n }\n\n| **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 `GoogleSignInAccount.getId`, and on the backend from the `sub` claim of the ID token.\n\nFor additional profile data that might be available, see\n[`GoogleSignInAccount`](/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInAccount).\nNote that any of the profile fields can be `null`, depending on which scopes\nyou requested and what information the user's profile includes."]]