Login and Authorization
Obtain credentials to call other APIs through the Login and Authorization API.
Get or Refresh Token
POST /m-api/oauth2/token2 HTTP/1.1
Host: app.fileshow.com
Request Parameters
Common Parameters:
| Parameter | Required | Description |
|---|---|---|
| client_id | Yes | Client ID assigned |
| grant_type | Yes | password for account password login;refresh_token to refresh access_token using refresh_token;exchange_token to exchange third-party authorization code or token for Fileshow access_token;gkkey for GKKey authentication |
| dateline | Yes | Current Unix timestamp in seconds |
| sign | Yes | Signature |
Parameters for grant_type=password:
| Parameter | Required | Description |
|---|---|---|
| username | Yes | User login account |
| password | Yes | User password, MD5 hash of the original password, 32-byte lowercase letters |
Parameters for grant_type=refresh_token:
| Parameter | Required | Description |
|---|---|---|
| refresh_token | Yes | Refresh token from previous authorization |
Parameters for grant_type=exchange_token:
| Parameter | Required | Description |
|---|---|---|
| exchange_token | Yes | Third-party authorization code or token |
| domain | Yes | Pre-assigned value |
| auth | No | Pre-assigned value |
Parameters for grant_type=gkkey:
| Parameter | Required | Description |
|---|---|---|
| gkkey | Yes | GKKey to be verified |
Response Format
JSON
Response
HTTP 200
{
"access_token": "26SczD3Poj1obd0o7jzZotH1meg",
"expires_in": 21600,
"refresh_token": "TJ8gTQtz2riUfl1wwfVuu3ARr5o"
}
| Field | Type | Description |
|---|---|---|
| access_token | string | Token to call other APIs |
| expires_in | number | Expiration time of access_token, in seconds |
| refresh_token | string | refresh_token used to refresh access_token, valid for 7 days |
Errors
HTTP STATUS >= 400
{
"error": "Error Code",
"error_description": "Error Description"
}
| error | Description |
|---|---|
| invalid_request | Invalid request parameters |
| unsupported_grant_type | Invalid grant_type |
| invalid_client | Invalid client_id |
| unauthorized_client | client_id does not have permission for the requested grant_type |
| deprecated_client | client_id has expired or is disabled |
| invalid_token | Invalid refresh_token or gkkey |
| invalid_grant | Authentication failed |
| access_denied | IP address of the requester is blocked |
| second_verify | Requires two-factor authentication |