AuthResponse

public final class AuthResponse extends Object

Represents the response received from Play Games Services when requesting a server-side OAuth 2.0 authorization code for the signed-in player.

This response provides credentials and information intended for your server to enable server-side interaction with Play Games Services web APIs on behalf of the player. It includes:

The OAuth 2.0 authorization code: A short-lived credential to be sent securely to your server. Your server can exchange this code for access and refresh tokens, enabling server-side API calls.

The list of granted scopes: A list of the AuthScope permissions the user explicitly granted consent for (or previously approved). The list will be empty if the user declines consent and none of the requested AuthScope were previously granted.

Public Constructor Summary

AuthResponse(String authCode, List<AuthScope> grantedScopes)
Constructs an AuthResponse with the provided granted scopes and authentication code.

Public Method Summary

boolean
String
getAuthCode()
Returns the OAuth 2.0 authorization code.
List<AuthScope>
getGrantedScopes()
Returns the list of AuthScope permissions that the user has granted.
int
String

Inherited Method Summary

Public Constructors

public AuthResponse (String authCode, List<AuthScope> grantedScopes)

Constructs an AuthResponse with the provided granted scopes and authentication code.

Parameters
authCode The authentication code.
grantedScopes A list of AuthScope objects representing the granted scopes. Must not be null.
Throws
NullPointerException if grantedScopes is null.

Public Methods

public boolean equals (Object o)

public String getAuthCode ()

Returns the OAuth 2.0 authorization code.

This code is a short-lived credential that should be sent securely to your server to be exchanged for an access token and conditionally a refresh token. The access token may then be used by your server to access the Play Games Services web APIs.

Returns
  • A @NonNull string containing the OAuth 2.0 authorization code.

public List<AuthScope> getGrantedScopes ()

Returns the list of AuthScope permissions that the user has granted.

A list of the AuthScope permissions the user explicitly granted consent for (or previously approved). The list will be empty if the user declines consent and none of the requested AuthScope were previously granted.

Returns
  • A @NonNull List of AuthScope objects, representing the granted permissions. This list will be empty if the user declines the current consent request and none of the requested AuthScope were previously granted by the user.

public int hashCode ()

public String toString ()