Table of Contents

Obtaining Access Token

Overview

Authorization Method

Interface Dimension Authorization Default Authorization This API is granted by default, so you don't need to apply for interface dimension authorization separately for your authorization account. Please refer to Authorization Methods.

Notes

  • This API has IP access restrictions;
  • When applying for an authorization account, you need to inform OrionStar of the public IP address of the server (caller) that calls this API. OrionStar needs to add this IP address to the whitelist before you can successfully call this API;
  • Note: Please ensure that the secret is only saved and used on the server side. Do not save or use it on the web front end or client side to prevent secret leakage;

Request

Request Entry Point

Request Protocol

HTTP URL Path /v1/auth/get_token
HTTP Method GET

Request URL Parameters

Parameter Type Required Description
appid string Yes Appid issued by OrionStar
secret string Yes Secret issued by OrionStar
grant_type string Yes Fixed constant string client_credential

Request cURL Example

curl --location 'https://global-openapi.orionstar.com/v1/auth/get_token?appid=test_appid&secret=test_secret&grant_type=client_credential'

Response

Common Response Body

Parameter Type Description
code int Error code. 0 means success, non-zero means failure, Please refer to Error Codes.
msg string Error description. When there is a failure, a specific error description will be provided.
req_id string Log tracking ID. When encountering problems that require assistance from OrionStar, please provide this tracking ID value.
data object Business data object, see below for details Response Body Data Object.

Response Body Data Object

Parameter Type Description
access_token string access_token
expire_in int Validity period of access_token, usually 2 hours, specific validity period subject to the returned value. Unit is in seconds.

Response Body Example

{
    "code": 0,
    "msg": "",
    "data": {
        "access_token": "test_access_token",
        "expire_in": 7200
    }
}