Autenticação
Produção:
POST
https://oauth2.validapay.com.br/auth/tokenSandbox:
POST
https://oauth2-sandbox.validapay.com.br/auth/tokenEscopos disponíveis
Informe o escopo desejado no parâmetro scope ao solicitar o token. Para múltiplos escopos, separe por espaço.
| Escopo | Descrição |
|---|---|
pix.cob/write | Criar cobranças Pix |
pix.cob/read | Consultar cobranças Pix |
proposals/write | Criar propostas de conta |
proposals/read | Consultar status de propostas |
accounts/write | Criar e gerenciar contas |
accounts/read | Consultar informações de contas |
checkouts/write | Criar checkouts |
checkouts/read | Consultar checkouts |
Body
application/x-www-form-urlencoded
Content-Type:application/x-www-form-urlencoded
| Name | Type | Value | Required | Description |
|---|---|---|---|---|
| grant_type | text | client_credentials | Required | - Tipo de autenticação. Valor fixo: client_credentials |
| client_id | text | {{client_id}}(variável) | Required | - |
| client_secret | text | {{client_secret}}(variável) | Required | - |
| scope | text | {{scope}}(variável) | Required | - |
const url = 'https://oauth2.validapay.com.br/auth/token';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: 'grant_type=client_credentials&client_id=%7B%7Bclient_id%7D%7D&client_secret=%7B%7Bclient_secret%7D%7D&scope=%7B%7Bscope%7D%7D'
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Response Examples
200200
{
"access_token": "eyJraWQiOiJleGVtcGxvIiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAiLCJ0b2tlbl91c2UiOiJhY2Nlc3MiLCJzY29wZSI6ImFjY291bnQvcmVhZCIsImNsaWVudF9pZCI6ImV4ZW1wbG9jbGllbnRpZDEyMzQ1Njc4OTAiLCJpc3MiOiJodHRwczovL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tL3VzLWVhc3QtMV9FWEVNUExPIiwiZXhwIjoxOTAwMDAwMDAwLCJpYXQiOjE4OTk5OTY0MDB9.ASSINATURA_DE_EXEMPLO",
"expires_in": 3600,
"token_type": "Bearer"
}