social / pragma.account / AccountService / authenticateOrCreateV2 /

authenticateOrCreateV2 #

suspend fun authenticateOrCreateV2(session: ServiceSession, request: AccountRpc.AuthenticateOrCreateV2Request): AccountRpc.AuthenticateOrCreateV2Response

Authenticates a user against an IdentityProvider, creates a Pragma Account (if it does not exist), and returns SessionTokens used for gateway authentication.

If called without a gameShardId on the request, this will only authenticate the user with the social shard and therefore only return a social session token.

References

Plugins

  • IdentityProvider.canAuthenticate
  • IdentityProvider.validate - PragmaResultErrors returned are just thrown as PragmaExceptions
  • AccountPlugin.onAccountLogin - Called when the user successfully authenticates, including when the user is created
  • AccountPlugin.onAccountCreate - Called before an account is created for the first time
  • AccountPlugin.onAccountCreated - Called after an account is created for the first time

PragmaResultErrors

  • PragmaError.AccountService_Error when authenticating with an unknown or disabled IdentityProvider.
  • PragmaError.AccountService_Error when social id cannot be created
  • PragmaError.AccountService_NotFound when the requested game shard does not exist
  • PragmaError.Database_Error when failing to create a social identity
  • PragmaError.Database_Error when failing to create a player identity
  • PragmaError.AccountService_Unauthorized when trying to authenticate with an unexpected session type
  • PragmaError.AccountService_Error when failing to create authentication tokens
  • PragmaError.AccountService_RanOutOfDiscriminators when display name has been reused too many times