Skip to content
Giampaolo Falqui edited this page Jan 2, 2014 · 4 revisions

TFASAMP::prepareConnection(host[], password[], api_key[], type[] = "production", bool:tfa_debug = false)

This function prepares the connection to your hosting in order to request the APIs.

  • host[] = Your webhosting link and the directory, if any (without http://).
  • password[] = The password to use the PHP files to communicate with the APIs.
  • api_key[] = You may find it in your Authy's dashboard.
  • type[] = Choose your connection type between 'development (http)' and 'production (https)'.
  • bool:tfa_debug = You can decide if you want to activate the debug mode or not.

TFASAMP::createUser(playerid, email[], cellphone[], area_code[] = "1")

The connection must have been prepared or you may not use this function.

This function adds a new user to your Authy application.

User is matched based on cellphone and country code not e-mail. A cellphone is uniquely associated with an authy_id.

  • playerid = playerid of the player you wish to add in your Authy application.
  • email[] = email of the player you wish to add in your Authy application.
  • cellphone[] = Cellphone number of the player you wish to add in your Authy application.
  • area_code[] = International cellphone number prefix - you may find them at www.countrycode.org under the 'Country Code' column.

@returns true if the function has been properly executed, false if not.

Notes: the internal callback TFASAMP_createUser_response will give you the userid of the player to be used for the token verification.


TFASAMP::verifyToken(playerid, user_id, token[], bool: force = true)

The connection must have been prepared or you may not use this function.

This function checks a token if valid or invalid.

Token verification is only enforced if the user has completed registration. To change this behaviour see Forcing Verification section below.

Registration is completed once the user installs and registers the Authy mobile app or logins once successfully using SMS.

  • playerid = playerid of the player you wish to check the token.
  • user_id[] = userid of the player you wish to check the token (check the internal callback TFASAMP_createUser_response or your Authy's dashboard for clarifications).
  • token[] = token to be checked.
  • force[] (bool: true) = It's recommended to leave this true. If user has not finished registration any token always works.

@returns true if the function has been properly executed, false if not.

Notes: the callback TFASAMP::OnVerifyToken will give you the userid of the player to be used for the token verification, make sure to save it in your database.


TFASAMP::setPlayerUserID(playerid)

The connection must have been prepared or you may not use this function.

This function sets the Authy's userid to a playerid.

  • playerid = playerid of the player you wish to set.
  • user_id[] = authy userid you wish to set.

TFASAMP::getPlayerUserID(playerid)

The connection must have been prepared or you may not use this function.

This function retrieves the Authy's userid of a playerid.

  • playerid = playerid of the player you wish to know the authy userid.

@returns the authy userid of the playerid.