MG+ K2 Common Wallet API Integration Quick Guide
Breadcrumbs

Get an STS Token

To start, obtain an STS Token, which acts as the authorization token for all MG+ API interactions.

To generate an STS Token, provide your Agent Code and Agent Secret to STS. In response, you'll receive a JWT token for use in future MG+ API calls.

  1. Find your STS URL. This can be found in MG+ Backoffice, or given to you by your Account Manager.

    image-20240327-064229.png
  2. Create a request.

    1. Replace the URL with your STS URL.

      1. In the request example, this is the sts-demo.k2net.io portion of the endpoint.

    2. Replace the client_id with your Agent Code.

      1. In the request example, this is the DemoAgent portion of the request header.

    3. Replace the client_secret with your Agent Secret.

      1. In the request example, this is the 4c7dd71e1b5ab52c27beb283fae9ab portion of the request body.

Request Example

POST https://sts-demo.k2net.io/connect/token


Request Headers

JSON
Content-Type: “application/x-www-form-urlencoded”


Request Body

JSON
{
  client_id: “DemoAgent”
  client_secret: “4c7dd71e1b5ab52c27beb283fae9ab”
  grant_type: “client_credentials”
}


  1. Your STS Token is returned in the access_token response.

Response Example

200 Response Body Example

JSON
{
  "access_token": “token”,
  "expires_in": 3600,
  "token_type": "Bearer"
}


Checklist

  • Did you use the correct STS URL from your Account Manager or MG+ Backoffice?
  • Did you put /connect/token after the STS URL?
  • Did you use the POST method?
  • Is your IP address whitelisted?