HiveMP Sessions Quickstart

How did we do?

This quickstart shows you how to set up HiveMP Sessions and create a new session.

Create a project

  1. Sign into the Admin Console.
  2. Under Projects, click Create Project.
  3. Type a name for your new project in the Name field.
  4. Optionally fill in the Public Name, Developer Name and other fields. You won't be able to set a Website URL until after you've saved the project.
  5. Click Create.
  6. Switch to the new project using the project switcher in the top-right of the Admin Console.

Create a public API key

  1. Under API Keys, click Create Public API Key.
  2. Type a comment that describes what you'll be using this API key for. For example: "User Authentication for Basic Testing".
  3. Click Create.
  4. In the list of API keys, click Reveal next to the API key you just created and copy the API key.

Create a session

To quickly get started, you can use a provided test account to create a session:

read -r -d '' _request_body << EOM
{
  "emailAddress": "[email protected]",
  "marketingPreferenceOptIn": false,
  "metered": true,
  "passwordHash": "e72919d00bd0e67c796192a601d21b805cf92dfe3ecf019be57a182cb320a25a",
  "projectId": null,
  "promptForProject": null,
  "requestedRole": "builtin:user",
  "tokens": {
    "deviceTestTokens": [],
    "discordTokens": [],
    "itchIoTokens": [],
    "oAuthTokens": [],
    "steamTokens": []
  },
  "twoFactor": null
}
EOM
curl -s \
  -H "X-API-Key: $apiKey" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  --data "$_request_body" \
  -X PUT \
  "https://user-session-api.hivemp.com/v1/authenticate"

After you run the above command, you should receive a new session with a response like this:

{
  "authenticatedSession": {
    "accountId": "u-5705148370255872",
    "apiKey": "...",
    "billedMinutes": 0,
    "expiry": 1533535836,
    "id": "us-...",
    "metered": true,
    "profile": {
      "allowDiscoveryByEmailAddress": false,
      "allowPublicVisibility": false,
      "avatarUrl": null,
      "canSendVerificationEmail": true,
      "descriptionHtml": null,
      "descriptionUnsafeMarkdown": null,
      "displayName": null,
      "emailVerificationPending": true,
      "handle": null,
      "id": "u-5705148370255872",
      "locationCity": null,
      "locationCountry": null,
      "locationState": null,
      "locationText": null,
      "passwordResetPending": false,
      "realName": null,
      "relationship": "self"
    },
    "projectId": "p-...",
    "secretKey": "...",
    "start": 1533532236
  },
  "availableProjects": null,
  "intent": "login",
  "passwordResetEmailSent": false,
  "promptForEmailAddress": false,
  "promptForMarketingPreferenceOptIn": false,
  "promptForPassword": false,
  "promptForProject": false,
  "promptForTwoFactor": false
}

Further reading