Take a sneak peak of our new documentation Read More
Last Updated: 11/16/2022, 8:16:42 AM

# Get Authorized In Swagger

# Overview

Swagger is a toolset that simplifies API development by helping you design and document your APIs.

AccelByte uses Swagger to develop and manage its API endpoints (opens new window).


You can get authorization to use Swagger either by using the Admin Portal or by using Curl.

Follow the steps below to get authorization in Swagger, so that you can test our API endpoints (opens new window).

# Using the Admin Portal

Follow the steps below to get authorization using the Admin Portal:

  1. In the Admin Portal, open the Platform Configurations menu in the top-right corner of the screen, and click OAuth Clients.
  2. Browse the list of clients to find the one you’d like to use to access the endpoints, and click View next to the client to open it.
  3. In the Client Details window, copy the Client ID.
  4. Make note of the namespace the client is located in as well; you’ll need this information later.


  1. Open the API endpoint for the service you want to access, for example IAM. You can find the list of our services on the API Endpoints (opens new window) page.

  2. Click the Authorize button in the top-right corner of the screen.


  1. The Available authorizations window will appear and contains two options: authorization (apiKey) and Basic authorization. Under Basic authorization, paste the Client ID from earlier into the Username box.


  1. Type a random sequence of characters in the Password field and then delete them. Click the Authorize button.


You need to type something into the Password field under Basic authorization and then delete it before pressing Authorize. Otherwise, Swagger will denote the password as undefined rather than an empty string, which will prevent logging in.

  1. Use the https://demo.accelbyte.io/iam/apidocs/#/OAuth2.0/TokenGrantV3 (opens new window) API endpoint. Click Try Out Now and then do the following:
  • Select password as your grant_type
  • Input your username and password for the Admin Portal
  • Input the namespace that contains the client whose ID you used to authorize.

When you’re finished, click Execute. The access token you need will be returned in the server response.


  1. Copy the contents of the Response body, starting with { “access_token” from the server response. This will be a very long string, as seen in the image above.

  2. Return to the Available authorizations window by clicking the green Authorize icon in the top-right corner of the Swagger page.


  1. In the authorization (apiKey) section, type the word BEARER (must be capitalized), followed by one space, then paste your access token. When you’re finished, click Authorize.


  1. Click Close in the Basic authorization section. You can now test the API endpoints.

# Using Curl

If you use Curl (opens new window), you can also get an access token for Swagger using the code below.

curl -X 'POST' \
  '<<base_url>>/iam/v3/oauth/token' \
  -H 'accept: application/json' \
  -H 'authorization: Basic <<client_credential>>' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=password&username=<<username>>&password=<<password>>'
  1. Type the above code into command prompt:
  • Replace <<base_url>> with your base URL.
  • Replace <<client_credential>> with your OAuth Token in the format of client_id:client_secret, in base64 encoding.
  • Replace <<username>> with your username.
  • Replace <<password>> with your password.

When you’re finished, click Enter.

# Response

Here is an example response to a successful request:

  "access_token": "string",
  "bans": [
      "ban": "string",
      "disabledDate": "2022-09-01T03:19:32.816Z",
      "enabled": true,
      "endDate": "2022-09-01T03:19:32.816Z",
      "targetedNamespace": "string"
  "display_name": "string",
  "expires_in": 0,
  "is_comply": true,
  "jflgs": 0,
  "namespace": "string",
  "namespace_roles": [
      "namespace": "string",
      "roleId": "string"
  "permissions": [
      "action": 0,
      "resource": "string",
      "schedAction": 0,
      "schedCron": "string",
      "schedRange": [
  "platform_id": "string",
  "platform_user_id": "string",
  "refresh_expires_in": 0,
  "refresh_token": "string",
  "roles": [
  "scope": "string",
  "token_type": "string",
  "user_id": "string",
  "xuid": "string"


You can copy the access_token value from the response and paste it into Swagger preceded by the word BEARER, as in step 12 of the Using the Admin Portal (opens new window) section above.