Exchange or refresh OAuth tokens
curl --request POST \
--url 'https://api.swapnice.com/oauth/token?client_secret=' \
--header 'Content-Type: application/json' \
--data '
{
"grant_type": "authorization_code",
"code": "<string>",
"redirect_uri": "<string>",
"client_id": "<string>",
"client_secret": "<string>",
"code_verifier": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
grant_type: 'authorization_code',
code: '<string>',
redirect_uri: '<string>',
client_id: '<string>',
client_secret: '<string>',
code_verifier: '<string>'
})
};
fetch('https://api.swapnice.com/oauth/token?client_secret=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.swapnice.com/oauth/token?client_secret="
payload = {
"grant_type": "authorization_code",
"code": "<string>",
"redirect_uri": "<string>",
"client_id": "<string>",
"client_secret": "<string>",
"code_verifier": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"access_token": "swa_at_example",
"token_type": "Bearer",
"expires_in": 900,
"scope": "connections:write consent:write events:write profile:read"
}{
"error": "invalid_request",
"error_description": "<string>",
"error_uri": "<string>"
}{
"error": "invalid_request",
"error_description": "<string>",
"error_uri": "<string>"
}OAuth
Exchange or refresh a token
Trade an authorization code or refresh token for a Bearer access token.
POST
/
oauth
/
token
Exchange or refresh OAuth tokens
curl --request POST \
--url 'https://api.swapnice.com/oauth/token?client_secret=' \
--header 'Content-Type: application/json' \
--data '
{
"grant_type": "authorization_code",
"code": "<string>",
"redirect_uri": "<string>",
"client_id": "<string>",
"client_secret": "<string>",
"code_verifier": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
grant_type: 'authorization_code',
code: '<string>',
redirect_uri: '<string>',
client_id: '<string>',
client_secret: '<string>',
code_verifier: '<string>'
})
};
fetch('https://api.swapnice.com/oauth/token?client_secret=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.swapnice.com/oauth/token?client_secret="
payload = {
"grant_type": "authorization_code",
"code": "<string>",
"redirect_uri": "<string>",
"client_id": "<string>",
"client_secret": "<string>",
"code_verifier": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"access_token": "swa_at_example",
"token_type": "Bearer",
"expires_in": 900,
"scope": "connections:write consent:write events:write profile:read"
}{
"error": "invalid_request",
"error_description": "<string>",
"error_uri": "<string>"
}{
"error": "invalid_request",
"error_description": "<string>",
"error_uri": "<string>"
}Trade an authorization code or refresh token for a Bearer access token.
Accepts JSON or form-encoded bodies. Access tokens last about 15 minutes. Include
code_verifier for authorization-code exchanges.Authorizations
Form-style client secret authentication for confidential clients where HTTP Basic is unavailable.
Body
application/jsonapplication/x-www-form-urlencoded
⌘I