Users

API References for User Management Service

Explore the list of API functions available in TypeScript for managing users, including detailed descriptions and usage examples.

Authentication

Login with email

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

DynamicPixels.Auth.LoginWithEmail(input: LoginWithEmailParams): Promise<LoginResponse>;

Register with email

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

DynamicPixels.Auth.RegisterWithEmail(input: RegisterWithEmailParams): Promise<LoginResponse>;

Login with Google

With this function, you can log in user with Google Auth.

DynamicPixels.Auth.LoginWithGoogle(input: LoginWithGoogleParams): Promise<LoginResponse>;

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.Auth.LoginAsGuest(input: LoginAsGuestParams): Promise<LoginResponse>;

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.Auth.LoginWithToken(input: LoginWithTokenParams): Promise<LoginResponse>;

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.Auth.IsOtaReady(input: IsOtaReadyParams): Promise<boolean>;

Send OTA token

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

DynamicPixels.Auth.SendOtaToken(input: SendOtaTokenParams): Promise<boolean>;

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.

ServiceHub.Authentication.VerifyOtaToken(VerifyOtaTokenParams input);

Is logged in

This function returns the status of the user authentication.

DynamicPixels.Auth.IsLoggedIn():boolean

Logout

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

DynamicPixels.Auth.Logout():void

User Management

Find Users

This function helps you to find other users of the game, and then use their info in other functions.

DynamicPixels.Services.Users.FindUsers<T extends FindUsersParams>(input: T): Promise<User[]>

Get Current User's Info

This function returnsthe profile information of the current user

DynamicPixels.Services.Users.GetCurrentUser(): Promise<User>

Edit Current User Info

You can edit your current user profile with this function.

DynamicPixels.Services.Users.EditCurrentUser<T extends EditCurrentUserParams>(input: T): Promise<User>

Get User Info By Id

With this function, you can get the profile information of a specific user with his id

DynamicPixels.Services.Users.GetUserById<T extends GetUserByIdParams>(input: T): Promise<User>

Device Management

Get Users Devices

This function will return the active devices of the current user.

DynamicPixels.Services.Devices.GetMyDevices(): Promise<Device[]>;

Revoke Device Access

This function removes access to a specific device and forces it login again.

DynamicPixels.Services.Devices.RevokeDevice<T extends RevokeDeviceParams>(input: T): Promise<void>;

This function disables access to the revoked device and forces it to log in again.

Last updated