# Meta / Oculus

{% hint style="info" %}
The Meta / Oculus platform needs to be enabled and configured in the Web Console before it can be used in your game.
{% endhint %}

#### Configuration

To start using Meta / Oculus sign in we first need to configure our integration in the [platform settings](https://console.lootlocker.com/settings/platforms/meta).

<figure><img src="/files/HX1Pd9TPoHt52b0JARIZ" alt=""><figcaption></figcaption></figure>

**Meta App ID / App Secret**

Meta App ID and Meta App Secret can be retrieved from the [Meta Dashboard](https://developer.oculus.com/manage) 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](https://docs.unity.com/authentication/en-us/manual/platform-signin-oculus)

[Unreal](https://developer.oculus.com/reference/platform/v55/o_v_r_requests_user_8h/#a2c6a612f691e1009621c21d17b48c8d3)

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.

{% tabs %}
{% tab title="Unity" %}

```csharp
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;
});
```

{% endtab %}

{% tab title="Unreal" %}

<figure><img src="/files/fmsIegNrVB9cNu4oqYqs" alt=""><figcaption><p><a href="https://blueprintue.com/blueprint/_dqkgzpr/">Blueprint example of starting a Meta Session</a></p></figcaption></figure>
{% endtab %}

{% tab title="REST" %}

```bash
curl -X POST "https://api.lootlocker.io/game/session/meta" \
  -H "LL-Version: 2021-03-01" \
  -H "Content-Type: application/json" \
  -d "{\"game_key\": \"your_game_key\", \"user_id\": \"1234567890\", \"nonce\": \"0987654321\", \"game_version\": \"1.0.0.0\" }"
```

Example response:

```json
{
  "session_token": "eb13a7bf17efg36cb8481a8ds18809c7e85686e6",
  "player_id": 9358,
  "public_uid": "J72YP6MS",
  "player_name": null,
  "player_created_at": "2023-02-21T15:33:25+00:00",
  "check_grant_notifications": false,
  "check_deactivation_notifications": false,
  "seen_before": true,
  "refresh_token": "eyJh............................."
}
```

{% endtab %}
{% endtabs %}

#### 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.

{% tabs %}
{% tab title="Unity" %}

```csharp
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");
});
```

{% endtab %}

{% tab title="Unreal" %}

<figure><img src="/files/GOyHISYVvV0ieONfpYwS" alt=""><figcaption><p><a href="https://blueprintue.com/blueprint/_q87xto3/">Blueprint example of Refreshing a session</a></p></figcaption></figure>
{% endtab %}

{% tab title="REST" %}

```bash
curl -X POST "https://api.lootlocker.io/game/session/meta" \
  -H "LL-Version: 2021-03-01" \
  -H "Content-Type: application/json" \
  -d "{\"game_key\": \"your_game_key\", \"refresh_token\": \"748b....\", \"game_version\": \"1.0.0.0\" }"
```

Example response:

```json
{
  "session_token": "eb13a7bf17efg36cb8481a8ds18809c7e85686e6",
  "player_id": 9358,
  "public_uid": "J72YP6MS",
  "player_name": null,
  "player_created_at": "2023-02-21T15:33:25+00:00",
  "check_grant_notifications": false,
  "check_deactivation_notifications": false,
  "seen_before": true,
  "refresh_token": "eyJh............................."
}
```

{% endtab %}
{% endtabs %}

{% hint style="success" %}
Congratulations - you have now started using LootLocker in your game with Meta / Oculus authentication! Next up we suggest you look at our [feature set,](/the-basics/what-is-lootlocker.md#overview) and decide which ones you want to use in your game.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lootlocker.com/players/authentication/how-to/meta.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
