cURL
curl --request POST \
--url https://apicorp.algartelecom.com.br/oauth-portal/oauth-portal/access-token \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--header 'password: <password>' \
--header 'realm: <realm>' \
--header 'username: <username>' \
--data '
{
"client_id": "<string>",
"client_secret": "<string>"
}
'import requests
url = "https://apicorp.algartelecom.com.br/oauth-portal/oauth-portal/access-token"
payload = {
"client_id": "<string>",
"client_secret": "<string>"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>",
"username": "<username>",
"password": "<password>",
"realm": "<realm>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Content-Type': '<content-type>',
Authorization: '<authorization>',
username: '<username>',
password: '<password>',
realm: '<realm>'
},
body: JSON.stringify({client_id: '<string>', client_secret: '<string>'})
};
fetch('https://apicorp.algartelecom.com.br/oauth-portal/oauth-portal/access-token', 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://apicorp.algartelecom.com.br/oauth-portal/oauth-portal/access-token",
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([
'client_id' => '<string>',
'client_secret' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>",
"password: <password>",
"realm: <realm>",
"username: <username>"
],
]);
$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://apicorp.algartelecom.com.br/oauth-portal/oauth-portal/access-token"
payload := strings.NewReader("{\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("username", "<username>")
req.Header.Add("password", "<password>")
req.Header.Add("realm", "<realm>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apicorp.algartelecom.com.br/oauth-portal/oauth-portal/access-token")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.header("username", "<username>")
.header("password", "<password>")
.header("realm", "<realm>")
.body("{\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apicorp.algartelecom.com.br/oauth-portal/oauth-portal/access-token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request["username"] = '<username>'
request["password"] = '<password>'
request["realm"] = '<realm>'
request.body = "{\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "string",
"token_type": "string",
"expires_in": 0
}{
"error": "Invalid credentials"
}{
"error": "Unauthorized: Invalid token or expired session"
}Autentificação
Executa a criação de um token de acesso.
Executa a criação de um token de acesso. Copie e cole os valores padrões (default) nos respectivos campos antes de executar a requisição.
POST
/
oauth-portal
/
access-token
cURL
curl --request POST \
--url https://apicorp.algartelecom.com.br/oauth-portal/oauth-portal/access-token \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--header 'password: <password>' \
--header 'realm: <realm>' \
--header 'username: <username>' \
--data '
{
"client_id": "<string>",
"client_secret": "<string>"
}
'import requests
url = "https://apicorp.algartelecom.com.br/oauth-portal/oauth-portal/access-token"
payload = {
"client_id": "<string>",
"client_secret": "<string>"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>",
"username": "<username>",
"password": "<password>",
"realm": "<realm>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Content-Type': '<content-type>',
Authorization: '<authorization>',
username: '<username>',
password: '<password>',
realm: '<realm>'
},
body: JSON.stringify({client_id: '<string>', client_secret: '<string>'})
};
fetch('https://apicorp.algartelecom.com.br/oauth-portal/oauth-portal/access-token', 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://apicorp.algartelecom.com.br/oauth-portal/oauth-portal/access-token",
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([
'client_id' => '<string>',
'client_secret' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>",
"password: <password>",
"realm: <realm>",
"username: <username>"
],
]);
$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://apicorp.algartelecom.com.br/oauth-portal/oauth-portal/access-token"
payload := strings.NewReader("{\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("username", "<username>")
req.Header.Add("password", "<password>")
req.Header.Add("realm", "<realm>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apicorp.algartelecom.com.br/oauth-portal/oauth-portal/access-token")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.header("username", "<username>")
.header("password", "<password>")
.header("realm", "<realm>")
.body("{\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apicorp.algartelecom.com.br/oauth-portal/oauth-portal/access-token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request["username"] = '<username>'
request["password"] = '<password>'
request["realm"] = '<realm>'
request.body = "{\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "string",
"token_type": "string",
"expires_in": 0
}{
"error": "Invalid credentials"
}{
"error": "Unauthorized: Invalid token or expired session"
}Headers
Define o formato da requisição.
🔹 Valor padrão:
application/json
📌 Dica: Copie e cole esse valor no campo Content-Type.
Example:
"application/json"
Example:
"Basic MzQ4OSozNDMyLTMOMzItMTIz"
Username recebido por email.
Example:
"usuario@example.com"
Senha de acesso recebida por email.
Example:
"senha123"
Domínio de autenticação do Keycloak.
🔹 Valor padrão:
0d5a3954
📌 Dica: Copie e cole esse valor no campo realm.
Example:
"algar-telecom"
Body
application/json
Informações necessárias para criar o token.

