Summary: Inherited Constants | Fields | Methods | Inherited Methods | [Expand All]
public class

# GoogleSignInAccount

extends Object
implements SafeParcelable Parcelable

java.lang.Object
↳ | com.google.android.gms.auth.api.signin.GoogleSignInAccount

## Class Overview

Class that holds the basic account information of the signed in Google user.

## Summary

[Expand] Inherited Constants
From interface com.google.android.gms.common.internal.safeparcel.SafeParcelable
String | NULL |
From interface android.os.Parcelable
int | CONTENTS_FILE_DESCRIPTOR |
int | PARCELABLE_WRITE_RETURN_VALUE |

Fields
public static final Creator<GoogleSignInAccount> | CREATOR |

Public Methods
boolean | equals(Object obj)
String | getDisplayName() Returns the display name of the signed in user if you built your configuration starting from `new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)`} or with `requestProfile()` configured; `null` otherwise.
String | getEmail() Returns the email address of the signed in user if `requestEmail()` was configured; `null` otherwise.
String | getFamilyName() Returns the family name of the signed in user if you built your configuration starting from `new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)`} or with `requestProfile()` configured; `null` otherwise.
String | getGivenName() Returns the given name of the signed in user if you built your configuration starting from `new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)`} or with `requestProfile()` configured; `null` otherwise.
Set<Scope> | getGrantedScopes() Returns all scopes that have been authorized to your application.
String | getId() Returns the unique ID for the Google account if you built your configuration starting from `new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)`} or with `requestId()` configured; `null` otherwise.
String | getIdToken() Returns an ID token that you can send to your server if `requestIdToken(String)` was configured; `null` otherwise.
Uri | getPhotoUrl() Returns the photo url of the signed in user if the user has a profile picture and you built your configuration either starting from `new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)`} or with `requestProfile()` configured; `null` otherwise.
String | getServerAuthCode() Returns a one-time server auth code to send to your web server which can be exchanged for access token and sometimes refresh token if `requestServerAuthCode(String)` is configured; `null` otherwise.
void | writeToParcel(Parcel out, int flags)

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()
From interface android.os.Parcelable
abstract int | describeContents()
abstract void | writeToParcel(Parcel arg0, int arg1)

## Fields

#### public static final Creator<GoogleSignInAccount> CREATOR

## Public Methods

#### public boolean equals (Object obj)

#### public String getDisplayName ()

Returns the display name of the signed in user if you built your configuration starting from `new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)`} or with `requestProfile()` configured; `null` otherwise. Not guaranteed to be present for all users, even when configured.

#### public String getEmail ()

Returns the email address of the signed in user if `requestEmail()` was configured; `null` otherwise.

Applications should not key users by email address since a Google account's email address can change. Use `getId()` as a key instead.

Important: Do not use this returned email address to communicate the currently signed in user to your backend server. Instead, send an ID token (`requestIdToken(String)`), which can be securely validated on the server; or send server auth code (`requestServerAuthCode(String)`) which can be in turn exchanged for id token.

See Authenticate with a backend server for details.

#### public String getFamilyName ()

Returns the family name of the signed in user if you built your configuration starting from `new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)`} or with `requestProfile()` configured; `null` otherwise. Not guaranteed to be present for all users, even when configured.

#### public String getGivenName ()

Returns the given name of the signed in user if you built your configuration starting from `new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)`} or with `requestProfile()` configured; `null` otherwise. Not guaranteed to be present for all users, even when configured.

#### public Set<Scope> getGrantedScopes ()

Returns all scopes that have been authorized to your application.

This can be a larger set than what you have requested via `GoogleSignInOptions`. We recommend apps requesting minimum scopes at user sign in time and later requesting additional scopes incrementally when user is using a certain feature. For those apps following this incremental auth practice, they can use the returned scope set to determine all authorized scopes (across platforms and app re-installs) to turn on bonus features accordingly. The returned set can also be larger due to other scope handling logic.

#### public String getId ()

Returns the unique ID for the Google account if you built your configuration starting from `new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)`} or with `requestId()` configured; `null` otherwise.

This is the preferred unique key to use for a user record.

Important: Do not use this returned Google ID to communicate the currently signed in user to your backend server. Instead, send an ID token (`requestIdToken(String)`), which can be securely validated on the server; or send a server auth code (`requestServerAuthCode(String)`) which can be in turn exchanged for id token.

See Authenticate with a backend server for details.

#### public String getIdToken ()

Returns an ID token that you can send to your server if `requestIdToken(String)` was configured; `null` otherwise.

ID token is a JSON Web Token signed by Google that can be used to identify a user to a backend.

#### public Uri getPhotoUrl ()

Returns the photo url of the signed in user if the user has a profile picture and you built your configuration either starting from `new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)`} or with `requestProfile()` configured; `null` otherwise. Not guaranteed to be present for all users, even when configured.

#### public String getServerAuthCode ()

Returns a one-time server auth code to send to your web server which can be exchanged for access token and sometimes refresh token if `requestServerAuthCode(String)` is configured; `null` otherwise. for details.

##### See Also

- `requestServerAuthCode(String)`

#### public void writeToParcel (Parcel out, int flags)