Trocar sessão OAuth por tokens
curl --request POST \
--url https://api-bc.pgubright.com/auth/exchange-session \
--header 'Content-Type: application/json' \
--data '
{
"session_id": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({session_id: '<string>'})
};
fetch('https://api-bc.pgubright.com/auth/exchange-session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api-bc.pgubright.com/auth/exchange-session"
payload = { "session_id": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"access_token": "<string>",
"expires_in": 123,
"refresh_expires_in": 123,
"refresh_token": "<string>",
"token_type": "Bearer",
"scope": "<string>"
}{
"message": "Usuário sem permissão para operar neste sensor.",
"code": "SENSOR_FORBIDDEN"
}Autenticação
Trocar sessão OAuth por tokens
POST
/
auth
/
exchange-session
Trocar sessão OAuth por tokens
curl --request POST \
--url https://api-bc.pgubright.com/auth/exchange-session \
--header 'Content-Type: application/json' \
--data '
{
"session_id": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({session_id: '<string>'})
};
fetch('https://api-bc.pgubright.com/auth/exchange-session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api-bc.pgubright.com/auth/exchange-session"
payload = { "session_id": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"access_token": "<string>",
"expires_in": 123,
"refresh_expires_in": 123,
"refresh_token": "<string>",
"token_type": "Bearer",
"scope": "<string>"
}{
"message": "Usuário sem permissão para operar neste sensor.",
"code": "SENSOR_FORBIDDEN"
}