This module provides a login entry-point for auth server.

Constructor

Methods

bind (c:ClientAuth, params:Params):Dynamic

auth/user.bind

Creates a new login/provider authentication bind to user. If this user is already bound to this provider the old record will be deleted.

Note: This method can be called without logging in.

Input (common):

  • login - String. User auth login.
  • provider - String. User auth provider. Providers include: "goog", "appl", "fb", "cust", "adid".
  • loginInt - String. Internal auth user login.
  • authInt - String. Internal auth user password.

Input (internal):

Input (Google, provider "goog"):

Note: Requires all following internal variables to be set: "googlePlay.clientID", "googlePlay.secret".

Input (Apple, provider "appl"):

Described here: https://developer.apple.com/documentation/gamekit/gklocalplayer/1515407-generateidentityverificationsign

  • publicKeyUrl - String. Apple public encryption key URL.
  • signature - String. Verification signature.
  • salt - String. Random string salt.
  • timestamp - String. Timestamp of signature creation (Example: "1442816155502")

Input (Facebook, provider "fb"):

Note: Requires all following internal variables to be set: "facebook.clientID", "facebook.secret", "facebook.redirectURI".

Described here: https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/

  • auth - String. User access token.

Input (Advertising ID, provider "adid"):

  • No additional inputs.

Output:

  • errorCode - String. Operation error code.

Error codes:

  • ok - Operation successful.
  • authError - Generic auth error, something happened on the provider side.
  • internalVarsUnset - One or more of the internal variables is not set.
  • noSuchAuth - No such authentication bind.
  • noSuchUser - No such user.
  • paramsWrong - Wrong parameters.
  • unknownAuthType - This provider is not supported.

claimRestoreToken (c:ClientAuth, params:Params):Dynamic

auth/user.claimRestoreToken

Note: This method should be called without logging in.

Claims a one-time user account restoration token and returns new internal authentication credentials.

Input:

  • token - String. Account restore token.

Output:

  • errorCode - String. Operation error code.
  • uid - String. User UID.
  • password - String. New user password.

Error codes:

  • ok - Operation successful.
  • userOnline - User is online on a game server.
  • paramsWrong - Wrong parameters.
  • noSuchToken - No such restoration token.

exists (c:ClientAuth, params:Params):Dynamic

auth/user.exists

Checks if these login/provider authentication credentials exists.

Note: This method can be called without logging in.

Input:

  • login - String. User auth login.
  • provider - String. User auth provider.
  • id - Int. User numeric ID. Will check if this auth is bound to this user ID.

Output:

  • errorCode - String. Operation error code.
  • isSame - Bool. Do these authentication credentials belong to this user ID?

Error codes:

  • ok - Operation successful.
  • paramsWrong - Wrong parameters.
  • unknownAuthType - This provider is not supported.
  • noSuchAuth - No such authentication bind.

login (c:ClientAuth, params:Params):Dynamic

auth/user.login

Authenticates user through the auth provider and returns auth token.

Note: This method should be called without logging in.

Input (common):

  • login - String. User auth login.
  • provider - String. User auth provider. Use "__" in case of internal uid/password login. Other providers include: "goog", "appl", "fb", "adid", "cust".
  • resetInternalAuth - Bool. If set to true and provider is either "goog", "appl" or "fb", will reset internal password to a new one and return it in the response. Will also return internal user login. Needs the user to be offline.

Input (internal):

  • auth - String. Internal user auth key.

Input (Google, provider "goog"):

Note: Requires all following internal variables to be set: "googlePlay.clientID", "googlePlay.secret".

Input (Apple, provider "appl"):

Described here: https://developer.apple.com/documentation/gamekit/gklocalplayer/1515407-generateidentityverificationsign

  • publicKeyUrl - String. Apple public encryption key URL.
  • signature - String. Verification signature.
  • salt - String. Random string salt.
  • timestamp - String. Timestamp of signature creation (Example: "1442816155502")

Input (Facebook, provider "fb"):

Note: Requires all following internal variables to be set: "facebook.clientID", "facebook.secret", "facebook.redirectURI".

Described here: https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/

  • auth - String. User access token.

Input (Advertising ID, provider "adid"):

  • No additional inputs.

Output:

  • errorCode - String. Operation error code.
  • id - Int. User internal ID. Used to login into game and room servers.
  • token - String. Session token. Used to login into game and room servers.
  • login - String. User access token.
  • internalUID - String. Internal user login. Returned only on internal auth reset.
  • internalPassword - String. New internal user auth key. Returned only on internal auth reset.

Error codes:

  • ok - Operation successful.
  • internalVarsUnset - One or more of the internal variables is not set.
  • noSuchAuth - No such authentication bind.
  • noSuchUser - No such user.
  • paramsWrong - Wrong parameters.
  • unknownAuthType - This provider is not supported.
  • userBanned - User banned.

register (c:ClientAuth, params:Params):Dynamic

auth/user.register

Registers a new user account.

Note: This method should be called without logging in.

Input:

  • name - String. (optional) User name. Can be empty.

Output:

  • errorCode - String. Operation error code.
  • uid - String. Internal user ID.
  • password - String. Internal user password.

Error codes:

  • ok - Operation successful.
  • stringTooLong - Name longer than 100 symbols.
  • stringTooShort - Name shorter than 4 symbols (and not empty).