Frictionless - Guide

Simple code-only authentication [IDEN-Frictionless-02]

Initializing the Beamable SDK

Put this at the top of your class or any MonoBehaviour as a way to access the Beamable APIs.

private BeamContext _beamContext;

At face value, the following creates a player instance with access to Beamable APIs. But, under the hood, it is creating an anonymous user for you, if one doesn’t exist. It also assigns a User Id, also known as the PlayerId. The PlayerId can be used to look up the player in Portal.

private async void Start()
{
    _beamContext = BeamContext.Default;
    await beamContext.OnReady;
}

In this example we output the PlayerId to the console, which you can use to look up the Player in Portal.

Debug.Log($”User Id: {_beamContext.PlayerId}”);

By default, Beamable’s SDK always ensures there is a player token loaded, which means you will always have a unique user account that is anonymous. From here you can then use other forms of account linking/account creation such as Username & Password or Social Logins like Facebook (aka LoginThirdParty).

Not all games require authentication to be visible to get into the game. As such it is common practice to have frictionless login and the above shows you just how to do that.

Observe the classic flow of frictionless authentication.

You can always prompt the user to authenticate another way once the above step has been established. In fact just using the Login Prefab does the above process and then allows you to set a Display Name (alias) for the anonymous user.