public class

GoogleSignInOptionsBuilder

extends Object
java.lang.Object
   ↳ com.neomades.googlesignin.GoogleSignInOptionsBuilder

Class Overview

Builder for GoogleSignInOptions.

Cross-Platform considerations

Available only for Android.

Summary

Public Constructors
GoogleSignInOptionsBuilder()
Default Builder for GoogleSignInOptions which starts with default configuration for Google Sign In.
Public Methods
final GoogleSignInOptions build()
Builds the GoogleSignInOptions object.
final GoogleSignInOptionsBuilder requestEmail()
Specifies that email info is requested by your application.
final GoogleSignInOptionsBuilder requestIdToken(String serverClientId)
Specifies that an ID token for authenticated users is requested.
GoogleSignInOptionsBuilder requestServerAuthCode(String serverClientId)
Specifies that offline access is requested.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public GoogleSignInOptionsBuilder ()

Default Builder for GoogleSignInOptions which starts with default configuration for Google Sign In. You can get a stable user ID and basic profile info back via getId() after you trigger sign in from signIn(GoogleSignInCompletionListener).

Public Methods

public final GoogleSignInOptions build ()

Builds the GoogleSignInOptions object.

Returns

public final GoogleSignInOptionsBuilder requestEmail ()

Specifies that email info is requested by your application. Note that we don't recommend keying user by email address since email address might change. Keying user by ID is the preferable approach.

Returns
  • this builder

public final GoogleSignInOptionsBuilder requestIdToken (String serverClientId)

Specifies that an ID token for authenticated users is requested. Requesting an ID token requires that the server client ID be specified.
To obtain the server client ID, look at https://developers.google.com/identity/sign-in/android/start-integrating and look how to get your backend server's OAuth 2.0 client ID.

Parameters
serverClientId the client ID of the server that will verify the integrity of the token.
Returns
  • this builder

public GoogleSignInOptionsBuilder requestServerAuthCode (String serverClientId)

Specifies that offline access is requested. Requesting offline access requires that the server client ID be specified.
You don't need to use requestIdToken(String) when you use this option. When your server exchanges the code for tokens, an ID token will be returned together (as long as you use requestEmail() along with your configuration).
The first time you retrieve a code, a refresh_token will be granted automatically. Subsequent requests will only return codes that can be exchanged for access token.

Parameters
serverClientId The client ID of the server that will need the auth code.
Returns
  • this builder