Skip to main content
Version: 1.0.0

Authentication Plugin Functions

Authentication is a top-level service based on Users and Devices tables that provide the ability to authenticate and authorize users and generate tokens for them. In the following, we will review the functions of authentication service in plugins:

Login with email

This function will login a player with pair of email and password, and return the token as result.

DynamicPixels.Authentication.LoginWithEmail(LoginWithEmailParams input);

Register with email

This function will register a new user and then login him in and return the token.

DynamicPixels.Authentication.RegisterWithEmail(RegisterWithEmailParams input);

Login with Google

With this function, you can login user with Google Auth.

DynamicPixels.Authentication.LoginWithGoogle(LoginWithGoogleParams input);

Login as guest

If you want to login users easily and don't show any form, guest login is for you! This function will login users with a unique id and mark the user as a guest. also, you can edit the user and add additional information in the future.

DynamicPixels.Authentication.LoginAsGuest(LoginAsGuestParams input);

Login with token

When you login with any function, a token will return that will be used in requests to the server to identify the user. you should save this token in a safe place and load it on every game startup. to prevent login in every game session, you should call this function and pass the saved token.

DynamicPixels.Authentication.LoginWithToken(LoginWithTokenParams input);

Check OTA is ready

Check if OTA is available and developer can use it. you can fall back to other login ways if it's not available.

DynamicPixels.Authentication.IsOtaReady(new IsOtaReadyParams());

Send OTA token

If OTA is ready, this function will generate a random key and send it as SMS to specified phone number. this key is valid for few minutes to verify.

DynamicPixels.Authentication.SendOtaToken(SendOtaTokenParams input);

Verify OTA token

After sending OTA key, you should get it by a form and verify it with this function. after that, login process will be done.

DynamicPixels.Authentication.VerifyOtaToken(VerifyOtaTokenParams input);

Is logged in

This function return status of user athenticating.

DynamicPixels.Authentication.IsLoggenIn();

Logout

This function closes all connections and forgets the user's token. then you can login another user.

DynamicPixels.Authentication.Logout();