en:server_docs:authentication:access_token

Obtaining Access Token

Overview

  • This API is used to obtain the access token for OpenAPI;
  • For the usage of access_token, please refer to Calling Process;

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

HTTP URL Path /v1/auth/get_token
HTTP Method GET
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
curl --location 'https://global-openapi.orionstar.com/v1/auth/get_token?appid=test_appid&secret=test_secret&grant_type=client_credential'

Response

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.
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.
{
    "code": 0,
    "msg": "",
    "data": {
        "access_token": "test_access_token",
        "expire_in": 7200
    }
}
  • Last modified: 2024-04-09 20:52 +0800