Configuration
To start using Sign in with Discord we first need to configure our integration in the platform settings.
Client ID & Client Secret
Client ID can be retrieved from the Discord Developer Portal. If you don't have an Application, you will have to create.
Start Session
You need to acquire either a Discord Access Token or a Discord Refresh Token (also returned from the Access Token Exchange) to be able to start a Discord session, but once you have that, simply follow along to the code snippet below. 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.
coming soon
coming soon
curl -X POST "https://api.lootlocker.io/game/session/discord" \ -H "Content-Type: application/json" \ -d "{\"game_key\": \"your_game_key\", \"access_token\": \"eyJQa....\", \"game_version\": \"1.0.0.0\" }"Example response:
{ "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............................."}Refresh Session
With Discord 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.
curl -X POST "https://api.lootlocker.io/game/session/discord" \ -H "Content-Type: application/json" \ -d "{\"game_key\": \"your_game_key\", \"refresh_token\": \"eyJQa....\", \"game_version\": \"1.0.0.0\" }"Example response:
{ "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............................."}