GOG GALAXY SDK Documentation
IUser Class Referenceabstract

The interface for handling the user account. More...

#include <IUser.h>

Public Member Functions

virtual bool SignedIn ()=0
 Checks if the user is signed in to Galaxy. More...
 
virtual GalaxyID GetGalaxyID ()=0
 Returns the ID of the user, provided that the user is signed in. More...
 
virtual void SignInCredentials (const char *login, const char *password, IAuthListener *const listener=NULL)=0
 Authenticates the Galaxy Peer with specified user credentials. More...
 
virtual void SignInToken (const char *refreshToken, IAuthListener *const listener=NULL)=0
 Authenticates the Galaxy Peer with refresh token. More...
 
virtual void SignInLauncher (IAuthListener *const listener=NULL)=0
 Authenticates the Galaxy Peer based on launcher authentication. More...
 
virtual void SignInSteam (const void *steamAppTicket, uint32_t steamAppTicketSize, const char *personaName, IAuthListener *const listener=NULL)=0
 Authenticates the Galaxy Peer based on Steam Encrypted App Ticket. More...
 
virtual void SignInGalaxy (bool requireOnline=false, IAuthListener *const listener=NULL)=0
 Authenticates the Galaxy Peer based on Galaxy Client authentication. More...
 
virtual void SignInUWP (IAuthListener *const listener=NULL)=0
 
virtual void SignInPS4 (const char *ps4ClientID, IAuthListener *const listener=NULL)=0
 Authenticates the Galaxy Peer based on PS4 credentials. More...
 
virtual void SignInXB1 (const char *xboxOneUserID, IAuthListener *const listener=NULL)=0
 Authenticates the Galaxy Peer based on XBOX ONE credentials. More...
 
virtual void SignInXBLive (const char *token, const char *signature, const char *marketplaceID, const char *locale, IAuthListener *const listener=NULL)=0
 Authenticates the Galaxy Peer based on Xbox Live tokens. More...
 
virtual void SignInAnonymous (IAuthListener *const listener=NULL)=0
 Authenticates the Galaxy Game Server anonymously. More...
 
virtual void SignInAnonymousTelemetry (IAuthListener *const listener=NULL)=0
 Authenticates the Galaxy Peer anonymously. More...
 
virtual void SignInServerKey (const char *serverKey, IAuthListener *const listener=NULL)=0
 Authenticates the Galaxy Peer with a specified server key. More...
 
virtual void SignOut ()=0
 Signs the Galaxy Peer out. More...
 
virtual void RequestUserData (GalaxyID userID=GalaxyID(), ISpecificUserDataListener *const listener=NULL)=0
 Retrieves/Refreshes user data storage. More...
 
virtual bool IsUserDataAvailable (GalaxyID userID=GalaxyID())=0
 Checks if user data exists. More...
 
virtual const char * GetUserData (const char *key, GalaxyID userID=GalaxyID())=0
 Returns an entry from the data storage of current user. More...
 
virtual void GetUserDataCopy (const char *key, char *buffer, uint32_t bufferLength, GalaxyID userID=GalaxyID())=0
 Copies an entry from the data storage of current user. More...
 
virtual void SetUserData (const char *key, const char *value, ISpecificUserDataListener *const listener=NULL)=0
 Creates or updates an entry in the user data storage. More...
 
virtual uint32_t GetUserDataCount (GalaxyID userID=GalaxyID())=0
 Returns the number of entries in the user data storage. More...
 
virtual bool GetUserDataByIndex (uint32_t index, char *key, uint32_t keyLength, char *value, uint32_t valueLength, GalaxyID userID=GalaxyID())=0
 Returns a property from the user data storage by index. More...
 
virtual void DeleteUserData (const char *key, ISpecificUserDataListener *const listener=NULL)=0
 Clears a property of user data storage. More...
 
virtual bool IsLoggedOn ()=0
 Checks if the user is logged on to Galaxy backend services. More...
 
virtual void RequestEncryptedAppTicket (const void *data, uint32_t dataSize, IEncryptedAppTicketListener *const listener=NULL)=0
 Performs a request for an Encrypted App Ticket. More...
 
virtual void GetEncryptedAppTicket (void *encryptedAppTicket, uint32_t maxEncryptedAppTicketSize, uint32_t &currentEncryptedAppTicketSize)=0
 Returns the Encrypted App Ticket. More...
 
virtual SessionID GetSessionID ()=0
 Returns the ID of current session. More...
 
virtual const char * GetAccessToken ()=0
 Returns the access token for current session. More...
 
virtual void GetAccessTokenCopy (char *buffer, uint32_t bufferLength)=0
 Copies the access token for current session. More...
 
virtual bool ReportInvalidAccessToken (const char *accessToken, const char *info=NULL)=0
 Reports current access token as no longer working. More...
 

Detailed Description

The interface for handling the user account.

Member Function Documentation

◆ DeleteUserData()

virtual void DeleteUserData ( const char *  key,
ISpecificUserDataListener *const  listener = NULL 
)
pure virtual

Clears a property of user data storage.

This is the same as calling SetUserData() and providing an empty string as the value of the property that is to be altered.

This call in asynchronous. Responses come to the IUserDataListener and ISpecificUserDataListener.

Parameters
[in]keyThe name of the property of the user data storage.
[in]listenerThe listener for specific operation.

◆ GetAccessToken()

virtual const char* GetAccessToken ( )
pure virtual

Returns the access token for current session.

Remarks
This call is not thread-safe as opposed to GetAccessTokenCopy().
The access token that is used for current session might be updated in the background automatically, without any request for that. Each time the access token is updated, a notification comes to the IAccessTokenListener.
Returns
The access token.

◆ GetAccessTokenCopy()

virtual void GetAccessTokenCopy ( char *  buffer,
uint32_t  bufferLength 
)
pure virtual

Copies the access token for current session.

Remarks
The access token that is used for current session might be updated in the background automatically, without any request for that. Each time the access token is updated, a notification comes to the IAccessTokenListener.
Parameters
[in,out]bufferThe output buffer.
[in]bufferLengthThe size of the output buffer.

◆ GetEncryptedAppTicket()

virtual void GetEncryptedAppTicket ( void *  encryptedAppTicket,
uint32_t  maxEncryptedAppTicketSize,
uint32_t &  currentEncryptedAppTicketSize 
)
pure virtual

Returns the Encrypted App Ticket.

If the buffer that is supposed to take the data is too small, the Encrypted App Ticket will be truncated to its size.

Precondition
Retrieve an Encrypted App Ticket first by calling RequestEncryptedAppTicket().
Parameters
[in,out]encryptedAppTicketThe buffer for the Encrypted App Ticket.
[in]maxEncryptedAppTicketSizeThe maximum size of the Encrypted App Ticket buffer.
[out]currentEncryptedAppTicketSizeThe actual size of the Encrypted App Ticket.

◆ GetGalaxyID()

virtual GalaxyID GetGalaxyID ( )
pure virtual

Returns the ID of the user, provided that the user is signed in.

Returns
The ID of the user.

◆ GetSessionID()

virtual SessionID GetSessionID ( )
pure virtual

Returns the ID of current session.

Returns
The session ID.

◆ GetUserData()

virtual const char* GetUserData ( const char *  key,
GalaxyID  userID = GalaxyID() 
)
pure virtual

Returns an entry from the data storage of current user.

Remarks
This call is not thread-safe as opposed to GetUserDataCopy().
Precondition
Retrieve the user data first by calling RequestUserData().
Parameters
[in]keyThe name of the property of the user data storage.
[in]userIDThe ID of the user. It can be omitted when reading own data.
Returns
The value of the property, or an empty string if failed.

◆ GetUserDataByIndex()

virtual bool GetUserDataByIndex ( uint32_t  index,
char *  key,
uint32_t  keyLength,
char *  value,
uint32_t  valueLength,
GalaxyID  userID = GalaxyID() 
)
pure virtual

Returns a property from the user data storage by index.

Precondition
Retrieve the user data first by calling RequestUserData().
Parameters
[in]indexIndex as an integer in the range of [0, number of entries).
[in,out]keyThe name of the property of the user data storage.
[in]keyLengthThe length of the name of the property of the user data storage.
[in,out]valueThe value of the property of the user data storage.
[in]valueLengthThe length of the value of the property of the user data storage.
[in]userIDThe ID of the user. It can be omitted when reading own data.
Returns
true if succeeded, false when there is no such property.

◆ GetUserDataCopy()

virtual void GetUserDataCopy ( const char *  key,
char *  buffer,
uint32_t  bufferLength,
GalaxyID  userID = GalaxyID() 
)
pure virtual

Copies an entry from the data storage of current user.

Precondition
Retrieve the user data first by calling RequestUserData().
Parameters
[in]keyThe name of the property of the user data storage.
[in,out]bufferThe output buffer.
[in]bufferLengthThe size of the output buffer.
[in]userIDThe ID of the user. It can be omitted when reading own data.

◆ GetUserDataCount()

virtual uint32_t GetUserDataCount ( GalaxyID  userID = GalaxyID())
pure virtual

Returns the number of entries in the user data storage.

Precondition
Retrieve the user data first by calling RequestUserData().
Parameters
[in]userIDThe ID of the user. It can be omitted when reading own data.
Returns
The number of entries, or 0 if failed.

◆ IsLoggedOn()

virtual bool IsLoggedOn ( )
pure virtual

Checks if the user is logged on to Galaxy backend services.

Remarks
Only a user that has been successfully signed in within Galaxy Service can be logged on to Galaxy backend services, hence a user that is logged on is also signed in, and a user that is not signed in is also not logged on.
Information about being logged on or logged off also comes to the IOperationalStateChangeListener.
Returns
true if the user is logged on to Galaxy backend services, false otherwise.

◆ IsUserDataAvailable()

virtual bool IsUserDataAvailable ( GalaxyID  userID = GalaxyID())
pure virtual

Checks if user data exists.

Precondition
Retrieve the user data first by calling RequestUserData().
Parameters
[in]userIDThe ID of the user. It can be omitted when checking for own data.
Returns
true if user data exists, false otherwise.

◆ ReportInvalidAccessToken()

virtual bool ReportInvalidAccessToken ( const char *  accessToken,
const char *  info = NULL 
)
pure virtual

Reports current access token as no longer working.

This starts the process of refreshing access token, unless the process is already in progress. The notifications come to IAccessTokenListener.

Remarks
The access token that is used for current session might be updated in the background automatically, without any request for that. Each time the access token is updated, a notification comes to the IAccessTokenListener.
If the specified access token is not the same as the access token for current session that would have been returned by GetAccessToken(), the report will not be accepted and no further action will be performed. In such case do not expect a notification to IAccessTokenListener and simply get the new access token by calling GetAccessToken().
Parameters
[in]accessTokenThe invalid access token.
[in]infoAdditional information, e.g. the URI of the resource it was used for.
Returns
true if the report was accepted, false otherwise.

◆ RequestEncryptedAppTicket()

virtual void RequestEncryptedAppTicket ( const void *  data,
uint32_t  dataSize,
IEncryptedAppTicketListener *const  listener = NULL 
)
pure virtual

Performs a request for an Encrypted App Ticket.

This call is asynchronous. Responses come to the IEncryptedAppTicketListener.

Parameters
[in]dataThe additional data to be placed within the Encrypted App Ticket with the limit of 1023 bytes.
[in]dataSizeThe size of the additional data.
[in]listenerThe listener for specific operation.

◆ RequestUserData()

virtual void RequestUserData ( GalaxyID  userID = GalaxyID(),
ISpecificUserDataListener *const  listener = NULL 
)
pure virtual

Retrieves/Refreshes user data storage.

This call is asynchronous. Responses come to the IUserDataListener and ISpecificUserDataListener.

Parameters
[in]userIDThe ID of the user. It can be omitted when requesting for own data.
[in]listenerThe listener for specific operation.

◆ SetUserData()

virtual void SetUserData ( const char *  key,
const char *  value,
ISpecificUserDataListener *const  listener = NULL 
)
pure virtual

Creates or updates an entry in the user data storage.

This call in asynchronous. Responses come to the IUserDataListener and ISpecificUserDataListener.

Remarks
To clear a property, set it to an empty string.
Parameters
[in]keyThe name of the property of the user data storage with the limit of 1023 bytes.
[in]valueThe value of the property to set with the limit of 4095 bytes.
[in]listenerThe listener for specific operation.

◆ SignedIn()

virtual bool SignedIn ( )
pure virtual

Checks if the user is signed in to Galaxy.

The user should be reported as signed in as soon as the authentication process is finished.

If the user is not able to sign in or gets signed out, there might be either a networking issue or a limited availability of Galaxy backend services.

After loosing authentication the user needs to sign in again in order for the Galaxy Peer to operate.

Remarks
Information about being signed in or signed out also comes to the IAuthListener and the IOperationalStateChangeListener.
Returns
true if the user is signed in, false otherwise.

◆ SignInAnonymous()

virtual void SignInAnonymous ( IAuthListener *const  listener = NULL)
pure virtual

Authenticates the Galaxy Game Server anonymously.

This call is asynchronous. Responses come to the IAuthListener (for all GlobalAuthListener-derived and optional listener passed as argument).

Remarks
Information about being signed in or signed out also comes to the IOperationalStateChangeListener.
Parameters
[in]listenerThe listener for specific operation.

◆ SignInAnonymousTelemetry()

virtual void SignInAnonymousTelemetry ( IAuthListener *const  listener = NULL)
pure virtual

Authenticates the Galaxy Peer anonymously.

This authentication method enables the peer to send anonymous telemetry events.

This call is asynchronous. Responses come to the IAuthListener (for all GlobalAuthListener-derived and optional listener passed as argument).

Parameters
[in]listenerThe listener for specific operation.

◆ SignInCredentials()

virtual void SignInCredentials ( const char *  login,
const char *  password,
IAuthListener *const  listener = NULL 
)
pure virtual

Authenticates the Galaxy Peer with specified user credentials.

This call is asynchronous. Responses come to the IAuthListener (for all GlobalAuthListener-derived and optional listener passed as argument).

Warning
This method is only for testing purposes and is not meant to be used in production environment in any way.
Remarks
Information about being signed in or signed out also comes to the IOperationalStateChangeListener.
Parameters
[in]loginThe user's login.
[in]passwordThe user's password.
[in]listenerThe listener for specific operation.

◆ SignInGalaxy()

virtual void SignInGalaxy ( bool  requireOnline = false,
IAuthListener *const  listener = NULL 
)
pure virtual

Authenticates the Galaxy Peer based on Galaxy Client authentication.

This call is asynchronous. Responses come to the IAuthListener (for all GlobalAuthListener-derived and optional listener passed as argument).

Remarks
Information about being signed in or signed out also comes to the IOperationalStateChangeListener.
Parameters
[in]requireOnlineIndicates if sing in with Galaxy backend is required.
[in]listenerThe listener for specific operation.

◆ SignInLauncher()

virtual void SignInLauncher ( IAuthListener *const  listener = NULL)
pure virtual

Authenticates the Galaxy Peer based on launcher authentication.

This call is asynchronous. Responses come to the IAuthListener (for all GlobalAuthListener-derived and optional listener passed as argument).

Remarks
Information about being signed in or signed out also comes to the IOperationalStateChangeListener.
Note
This method is for internal use only.
Parameters
[in]listenerThe listener for specific operation.

◆ SignInPS4()

virtual void SignInPS4 ( const char *  ps4ClientID,
IAuthListener *const  listener = NULL 
)
pure virtual

Authenticates the Galaxy Peer based on PS4 credentials.

This call is asynchronous. Responses come to the IAuthListener (for all GlobalAuthListener-derived and optional listener passed as argument).

Remarks
Information about being signed in or signed out also comes to the IOperationalStateChangeListener.
Parameters
[in]ps4ClientIDThe PlayStation 4 client ID.
[in]listenerThe listener for specific operation.

◆ SignInServerKey()

virtual void SignInServerKey ( const char *  serverKey,
IAuthListener *const  listener = NULL 
)
pure virtual

Authenticates the Galaxy Peer with a specified server key.

This call is asynchronous. Responses come to the IAuthListener.

Warning
Make sure you do not put your server key in public builds.
Remarks
Information about being signed in or signed out also comes to the IOperationalStateChangeListener.
Signing in with a server key is meant for server-side usage, meaning that typically there will be no user associated to the session.
Parameters
[in]serverKeyThe server key.
[in]listenerThe listener for specific operation.

◆ SignInSteam()

virtual void SignInSteam ( const void *  steamAppTicket,
uint32_t  steamAppTicketSize,
const char *  personaName,
IAuthListener *const  listener = NULL 
)
pure virtual

Authenticates the Galaxy Peer based on Steam Encrypted App Ticket.

This call is asynchronous. Responses come to the IAuthListener (for all GlobalAuthListener-derived and optional listener passed as argument).

Remarks
Information about being signed in or signed out also comes to the IOperationalStateChangeListener.
Parameters
[in]steamAppTicketThe Encrypted App Ticket from the Steam API.
[in]steamAppTicketSizeThe size of the ticket.
[in]personaNameThe user's persona name, i.e. the username from Steam.
[in]listenerThe listener for specific operation.

◆ SignInToken()

virtual void SignInToken ( const char *  refreshToken,
IAuthListener *const  listener = NULL 
)
pure virtual

Authenticates the Galaxy Peer with refresh token.

This call is asynchronous. Responses come to the IAuthListener (for all GlobalAuthListener-derived and optional listener passed as argument).

This method is designed for application which renders Galaxy login page in its UI and obtains refresh token after user login.

Remarks
Information about being signed in or signed out also comes to the IOperationalStateChangeListener.
Parameters
[in]refreshTokenThe refresh token obtained from Galaxy login page.
[in]listenerThe listener for specific operation.

◆ SignInUWP()

virtual void SignInUWP ( IAuthListener *const  listener = NULL)
pure virtual
Deprecated:
This method is no longer supported.

Authenticates the Galaxy Peer based on Windows Store authentication in Universal Windows Platform application.

This call is asynchronous. Responses come to the IAuthListener (for all GlobalAuthListener-derived and optional listener passed as argument).

Remarks
Information about being signed in or signed out also comes to the IOperationalStateChangeListener.
Parameters
[in]listenerThe listener for specific operation.

◆ SignInXB1()

virtual void SignInXB1 ( const char *  xboxOneUserID,
IAuthListener *const  listener = NULL 
)
pure virtual

Authenticates the Galaxy Peer based on XBOX ONE credentials.

This call is asynchronous. Responses come to the IAuthListener (for all GlobalAuthListener-derived and optional listener passed as argument).

Remarks
Information about being signed in or signed out also comes to the IOperationalStateChangeListener.
Parameters
[in]xboxOneUserIDThe XBOX ONE user ID.
[in]listenerThe listener for specific operation.

◆ SignInXBLive()

virtual void SignInXBLive ( const char *  token,
const char *  signature,
const char *  marketplaceID,
const char *  locale,
IAuthListener *const  listener = NULL 
)
pure virtual

Authenticates the Galaxy Peer based on Xbox Live tokens.

This call is asynchronous. Responses come to the IAuthListener (for all GlobalAuthListener-derived and optional listener passed as argument).

Remarks
Information about being signed in or signed out also comes to the IOperationalStateChangeListener.
Parameters
[in]tokenThe XSTS token.
[in]signatureThe digital signature for the HTTP request.
[in]marketplaceIDThe Marketplace ID
[in]localeThe user locale (example values: EN-US, FR-FR).
[in]listenerThe listener for specific operation.

◆ SignOut()

virtual void SignOut ( )
pure virtual

Signs the Galaxy Peer out.

This call is asynchronous. Responses come to the IAuthListener and IOperationalStateChangeListener.

Remarks
All pending asynchronous operations will be finished immediately. Their listeners will be called with the next call to the ProcessData().