Guide - Frictionless Authentication

Allow game makers to provide frictionless authentication

Overview

Here is everything needed to use frictionless authentication in the “Beamable SDK for Unity”.

Beamable’s SDK provides frictionless authentication by default when the SDK is initialized. This is completely done for you under the hood. It is quite simple, and thus the code sample for it will be short. However, this is an opportunity for you to learn more about the SDK and what it does for you when it is initialized from any “prefab” and or service.

Initializing the Beamable SDK

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

private IBeamableAPI _beamableAPI;

At face value, the following creates an instance of the Beamable API to use. You can access any of the API’s from here. 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 DBID. The DBID can be used to look up the player in Portal.

private async void Start(){
    _beamableAPI = await Beamable.API.Instance;
}

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

Debug.Log($”User Id: {_beamableAPI.User.id}”);

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.

📘

Related Guides

A common use case for the feature is covered in the guides.


Did this page help you?