curl --request POST \
--url https://api.identity.v2.portao3.com.br/auth/sign-in \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"grantType": "client_credentials"
}
'import requests
url = "https://api.identity.v2.portao3.com.br/auth/sign-in"
payload = { "grantType": "client_credentials" }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({grantType: 'client_credentials'})
};
fetch('https://api.identity.v2.portao3.com.br/auth/sign-in', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.identity.v2.portao3.com.br/auth/sign-in",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'grantType' => 'client_credentials'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.identity.v2.portao3.com.br/auth/sign-in"
payload := strings.NewReader("{\n \"grantType\": \"client_credentials\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.identity.v2.portao3.com.br/auth/sign-in")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"grantType\": \"client_credentials\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.identity.v2.portao3.com.br/auth/sign-in")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"grantType\": \"client_credentials\"\n}"
response = http.request(request)
puts response.read_body{
"accessToken": "eyJraWQiOiJrMSJ9.eyJzdWIiOiI0MzIzIn0.c2lnbmF0dXJl",
"idToken": "eyJraWQiOiJrMiJ9.eyJzdWIiOiI0MzIzIn0.c2lnbmF0dXJl",
"refreshToken": "eyJjdHkiOiJKV1QifQ.cmVmcmVzaA.aXY.Y2lwaGVy.dGFn"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "INVALID_CREDENTIALS",
"origin": "IDENTITY",
"message": "invalid_credentials"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "AUTH_ATTEMPT_BLOCKED",
"origin": "IDENTITY",
"message": "This attempt was blocked for security reasons. If you believe this is a mistake, contact support."
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "BAD_REQUEST",
"origin": "IDENTITY",
"message": "Bad Request: Your request is invalid or incomplete. Please make sure you are requesting with the right fields.",
"fields": [
{
"field": "grantType",
"message": "Invalid input: expected string, received undefined",
"code": "GRANTTYPE_REQUIRED"
}
]
}Sign in
Exchanges your API client’s credentials for an access token.
curl --request POST \
--url https://api.identity.v2.portao3.com.br/auth/sign-in \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"grantType": "client_credentials"
}
'import requests
url = "https://api.identity.v2.portao3.com.br/auth/sign-in"
payload = { "grantType": "client_credentials" }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({grantType: 'client_credentials'})
};
fetch('https://api.identity.v2.portao3.com.br/auth/sign-in', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.identity.v2.portao3.com.br/auth/sign-in",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'grantType' => 'client_credentials'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.identity.v2.portao3.com.br/auth/sign-in"
payload := strings.NewReader("{\n \"grantType\": \"client_credentials\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.identity.v2.portao3.com.br/auth/sign-in")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"grantType\": \"client_credentials\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.identity.v2.portao3.com.br/auth/sign-in")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"grantType\": \"client_credentials\"\n}"
response = http.request(request)
puts response.read_body{
"accessToken": "eyJraWQiOiJrMSJ9.eyJzdWIiOiI0MzIzIn0.c2lnbmF0dXJl",
"idToken": "eyJraWQiOiJrMiJ9.eyJzdWIiOiI0MzIzIn0.c2lnbmF0dXJl",
"refreshToken": "eyJjdHkiOiJKV1QifQ.cmVmcmVzaA.aXY.Y2lwaGVy.dGFn"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "INVALID_CREDENTIALS",
"origin": "IDENTITY",
"message": "invalid_credentials"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "AUTH_ATTEMPT_BLOCKED",
"origin": "IDENTITY",
"message": "This attempt was blocked for security reasons. If you believe this is a mistake, contact support."
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "BAD_REQUEST",
"origin": "IDENTITY",
"message": "Bad Request: Your request is invalid or incomplete. Please make sure you are requesting with the right fields.",
"fields": [
{
"field": "grantType",
"message": "Invalid input: expected string, received undefined",
"code": "GRANTTYPE_REQUIRED"
}
]
}clientId and clientSecret of an API client as HTTP Basic credentials in the Authorization header, and grantType: "client_credentials" in the body. Then call the API with Authorization: Bearer <accessToken>. Tokens are valid for 60 minutes; when one expires, sign in again. A deactivated API client can’t sign in.Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Body
Must be client_credentials. Send your API client's clientId and clientSecret as HTTP Basic credentials in the Authorization header: Basic base64(clientId:clientSecret).
client_credentials "client_credentials"
Response
Successful response
Tokens issued to an API client.
Send it as Authorization: Bearer <accessToken> on every request. Valid for 60 minutes: sign in again when it expires.
"eyJraWQiOiJrMSJ9.eyJzdWIiOiI0MzIzIn0.c2lnbmF0dXJl"
JWT with the API client's identity claims. Not needed to call the API. Valid for 60 minutes.
"eyJraWQiOiJrMiJ9.eyJzdWIiOiI0MzIzIn0.c2lnbmF0dXJl"
Not used by API clients: when the access token expires, sign in again.
"eyJjdHkiOiJKV1QifQ.cmVmcmVzaA.aXY.Y2lwaGVy.dGFn"