Skip to main content

WebGL Authentication

You can use MetX Authentication to allow your players to sign in to your game using the MetX Games Platform. This tutorial gets you started with MetX Authentication by showing you how to add sign-in to your WebGL game.

Authenticate via game iframe​

MetX's Games WebGL are loaded via iFrame.

Example banner

When the game is loaded, an auth is passed as a parameter. You can parse auth to identify your MetX Games players in-game via functions in the Wallet Autosigner.

Example banner

Using Unity? You can get the absoluteURL of your app using below snippet.

public string GetAuthFromWebGL()
{
int pm = Application.absoluteURL.IndexOf("?");
if (pm != -1)
{
auth = Application.absoluteURL.Split("?"[0])[1].Split("=")[1];
Debug.Log("new user: " + auth);
}

return auth;
}
note

The returned auth is a volatile string used to identify your players. This can retrieve the username, profile photo, wallet address of the user and can testify the identity and wallet ownership of that user. auth does not have any authoritative priviledges of the user account, and can be revoked at any time.

Try it out​

You can aquire auth for testing by signing into a MetX Gamer account, and then copying the auth parameter returned by signing in here!