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
- Before calling this API, you need to apply for an authorization account (appid and secret). Please refer to Calling Process and Authorization Methods;
- 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;
- Please refer to Calling Process and Authorization Methods;
- 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
Region | Entry Point |
---|---|
China Region | https://openapi.orionstar.com |
Europe Region | https://global-openapi.orionstar.com |
USA Region | https://us-openapi.orionstar.com |
Japan Region | https://jp-openapi.orionstar.com |
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
- entry point = Europe Region https://global-openapi.orionstar.com
- appid = test_appid
- secret = test_secret
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 } }