Android APIs
public class

GoogleSignInAccount

extends Object
implements 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 android.os.Parcelable
Fields
public static final Creator<GoogleSignInAccount> CREATOR
Public Methods
int describeContents()
boolean equals(Object obj)
String getDisplayName()
Gets the display name of the signed in user.
String getEmail()
Gets the email address of the signed in user.
Set<Scope> getGrantedScopes()
Gets all scopes that have been granted to your application.
String getId()
Gets the signed in user's Google id.
String getIdToken()
Gets an ID token that you can send to your server.
Uri getPhotoUrl()
Gets the photo url of the signed in user.
String getServerAuthCode()
Gets a one-time server auth code to send to your web server which can be exchanged for access token and sometimes refresh token.
void writeToParcel(Parcel out, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator<GoogleSignInAccount> CREATOR

Public Methods

public int describeContents ()

public boolean equals (Object obj)

public String getDisplayName ()

Gets the display name of the signed in user.

Returns
  • display name for the Google account. Only non-null if requestProfile() is configured.

public String getEmail ()

Gets the email address of the signed in user.

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

Returns
  • email address for the Google account. Only non-null if requestEmail() is configured.

public Set<Scope> getGrantedScopes ()

Gets all scopes that have been granted 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.

Returns
  • all scopes that have been authorized to your application

public String getId ()

Gets the signed in user's Google id.

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

Returns
  • the unique ID for the Google account.

public String getIdToken ()

Gets an ID token that you can send to your server.

Returns
  • a JSON Web Token signed by Google that can be used to identify a user to a backend. Only non-null if requestIdToken(String) is configured.

public Uri getPhotoUrl ()

Gets the photo url of the signed in user.

Returns
  • photo url for the Google account. Only non-null if requestProfile() is configured and user does have a Google+ profile picture.

public String getServerAuthCode ()

Gets a one-time server auth code to send to your web server which can be exchanged for access token and sometimes refresh token. for details.

Returns

public void writeToParcel (Parcel out, int flags)