1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2024-12-23 02:06:12 +02:00
OpenIntegrations/docs/en/md/Twitter/Data-and-settings/Get-token.md

50 lines
1.3 KiB
Markdown
Raw Normal View History

---
sidebar_position: 2
---
# Get token
Gets the token by the code received when authorizing using the link from GetAuthorizationLink
<br/>
2024-07-10 12:58:29 +02:00
`Function GetToken(Val Code, Val Parameters = "") Export`
| Parameter | CLI option | Type | Destination |
|-|-|-|-|
| Code | --code | String | Code obtained from authorization See GetAuthorizationLink |
| Parameters | --auth | Structure Of String | Authorization JSON or path to .json |
Returns: Map Of KeyAndValue - serialized JSON response from Twitter
2024-07-10 12:58:29 +02:00
```bsl title="Code example"
Response = OPI_Twitter.GetToken(Code, Parameters);
Response = OPI_Tools.JSONString(Response);
```
```sh title="CLI command example"
oint twitter GetToken --code %code% --auth %auth%
```
```json title="Result"
{
"refresh_token": "TmttM11111111111111111MY2dkNy1EZklLNmxIT1111111111111111xNTg2ODI6MTowOnJ0OjE",
"access_token": "UTBtWXd11111111111111111111113TkRxWEdxdF9hVlQzOjE3MDUwNTMxNTg2ODE6MTowOmF0OjE",
"scope": "mute.write tweet.moderate.write block.read follows.read offline.access list.write bookmark.read list.read tweet.write space.read block.write like.write like.read users.read tweet.read bookmark.write mute.read follows.write",
"expires_in": 7200,
"token_type": "bearer"
}
```