2024-06-05 12:19:46 +02:00
|
|
|
---
|
|
|
|
sidebar_position: 2
|
|
|
|
---
|
|
|
|
|
|
|
|
# Get token
|
|
|
|
Gets token based on the code from the GetAuthorizationLink page
|
|
|
|
|
|
|
|
|
2024-07-10 10:59:55 +02:00
|
|
|
<br/>
|
|
|
|
|
|
|
|
|
2024-07-10 12:58:29 +02:00
|
|
|
`Function GetToken(Val AppKey, Val AppSecret, Val Code) Export`
|
2024-06-05 12:19:46 +02:00
|
|
|
|
|
|
|
| Parameter | CLI option | Type | Destination |
|
|
|
|
|-|-|-|-|
|
|
|
|
| AppKey | --appkey | String | Application key |
|
|
|
|
| AppSecret | --appsecret | String | Application secret |
|
|
|
|
| Code | --code | String | Code from the authorization page |
|
|
|
|
|
|
|
|
|
2024-06-06 14:33:52 +02:00
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Dropbox
|
2024-06-05 12:19:46 +02:00
|
|
|
|
2024-07-10 13:05:58 +02:00
|
|
|
<br/>
|
2024-07-10 10:59:55 +02:00
|
|
|
|
2024-07-10 12:58:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-05 12:19:46 +02:00
|
|
|
```bsl title="Code example"
|
|
|
|
AppKey = "oynqxds...";
|
|
|
|
AppSecret = "tk2oewn...";
|
|
|
|
Code = "bTCiUTzxe6kAAAAAAAAAGN1NMZIxyqETKr4o7OS2dU8";
|
2024-06-05 12:35:05 +02:00
|
|
|
|
2024-06-05 12:19:46 +02:00
|
|
|
Result = OPI_Dropbox.GetToken(AppKey, AppSecret, Code);
|
|
|
|
```
|
2024-07-10 10:59:55 +02:00
|
|
|
|
|
|
|
|
2024-06-05 12:19:46 +02:00
|
|
|
|
|
|
|
```sh title="CLI command example"
|
|
|
|
|
|
|
|
oint dropbox GetToken --appkey "oynqxds..." --appsecret "tk2oewn..." --code "bTCiUTzxe6kAAAAAAAAAGN1NMZIxyqETKr4o7OS2dU8"
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```json title="Result"
|
2024-07-10 10:59:55 +02:00
|
|
|
{
|
2024-06-05 12:19:46 +02:00
|
|
|
"error": "invalid_grant",
|
|
|
|
"error_description": "code doesn't exist or has expired"
|
|
|
|
}
|
|
|
|
```
|