# Sequence Wallet Authentication

Gamers LAB offers native support for **Sequence wallet-style authentication**, enabling seamless web3 login flows for players through its REST server infrastructure. This integration provides a secure and straightforward method for identifying and authorizing users within blockchain-enabled games.

## 1. Wallet Sign-In with Sequence

Authentication begins by obtaining a **Sequence Wallet IdToken (JWT)**. This token is generated on the client side via the Sequence SDK and submitted to the Gamers LAB REST server for verification.

Once verified, the server issues a **custom Gamers LAB JWT**, which contains:

* A signed verification message
* The player’s unique `playerIndex`
* The associated `applicationId`
* Additional session-specific metadata

This JWT is used to authenticate all subsequent REST calls. The original Sequence Wallet IdToken is **single-use** and can be discarded after the Gamers LAB JWT has been issued.

## 2. Developer References

To assist developers with integration, Sequence provides documentation and code examples for both major engines:

* **Unreal Engine Guide** – [Unreal Guide](https://docs.sequence.xyz/sdk/unreal/onboarding/manage_sessions#get-id-token)
* **Unity Engine Guide** – [Unity Guide](https://docs.sequence.xyz/sdk/unity/onboard/session-management#get-id-token)

## 3. Example: Unity Authentication Call to Generate JWT

```
// Example: Getting the Sequence JWT token from the Unity game client
const jwt = await wallet.getIdToken();
```

## 4. Submit to Gamers L.A.B. Rest Server

Send the obtained JWT to the following endpoint:

```
// REST POST Request
POST /api/Auth/wallet/login/sequence-jwt
```

**Request Body:**

```json
{
  "jwt": "<your_sequence_id_token_here>"
}
```

**Server Response**

If valid, the Gamers LAB server will return a **platform-specific JWT.**

This JWT should be stored securely and used in the `Authorization: Bearer <token>` header for all future authenticated API calls.
