Meta / Oculus

Authenticate your players using Meta / Oculus and register a session for them on the LootLocker backend.

The Meta / Oculus platform needs to be enabled and configured in the Web Console before it can be used in your game.

Configuration

To start using Meta / Oculus sign in we first need to configure our integration in the platform settings.

Meta App ID / App Secret

Meta App ID and Meta App Secret can be retrieved from the Meta Dashboard in the API section for your app.

Start Session

You will need to fetch the UserID and Nonce using the Oculus SDK provided by Meta, more information can be found here:

Unity

Unreal

Next simply follow along to the code snippet below passing in the UserId and Nonce to LootLocker. In the response from LootLocker you will find a refresh token which can be used to refresh the session so that you do not need to do the full sign-in flow each time.

string userID = "user_id";
string nonce = "nonce";

LootLockerSDKManager.StartMetaSession(userID, nonce, (response) =>
{
    if (!response.success)
    {
        Debug.Log("error starting LootLocker session");

        return;
    }

    Debug.Log("session started successfully");

    // Store these to be able to refresh the session without using the full sign in flow
    string refreshToken = response.refresh_token;
});

Refresh Session

With Meta authentication, you can refresh the session instead of having the player do a full sign-in every time. The request will return a 401 (Unauthorized) if the refresh token has expired, in which case you will need to start a new session.

LootLockerSDKManager.RefreshMetaSession((response) =>
{
    if (!response.success)
    {
        if (response.statusCode == 401) {
            // Refresh token has expired, use StartMetaSession
        }
        else {
            Debug.Log("error starting LootLocker session");
        }

        return;
    }

    Debug.Log("session started successfully");
});

Congratulations - you have now started using LootLocker in your game with Meta / Oculus authentication! Next up we suggest you look at our feature set, and decide which ones you want to use in your game.

Last updated