> For the complete documentation index, see [llms.txt](https://docs.scorepositivo.com.br/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scorepositivo.com.br/autenticacao.md).

# Autenticação

## Token de acesso

Para todas as requisições de relatórios, resultados e extratos de uso, será exigido o token de acesso. O token é gerado no endpoint utilizando as suas credencias de acesso, que são fornecidas pelo seu gerente comercial.

As credenciais de acesso é composta pelos campos **client\_id** e **client\_secret.**

As credenciais fornecem o token de acesso (**access\_token**) , que é válido por 60 minutos, após esse período, o token é expirado e é necessário a requisição de um novo token.

{% hint style="warning" %} <mark style="color:orange;">**INFO**</mark>

O token pode ser reutilizado durante o período de validade sem necessidade de ser renovado.

Recomendamos <mark style="color:red;">**fortemente**</mark> a reutilização do token para melhor performance nos tempos de requisição.
{% endhint %}

## Gerar Token de acesso

{% hint style="info" %} <mark style="color:orange;">**POST**</mark>        <https://core.scorepositivo.com.br/oauth/token>
{% endhint %}

Parâmetros para a requisição do token:

<table><thead><tr><th width="286">Campo</th><th>Valor</th></tr></thead><tbody><tr><td><strong>grant_type</strong></td><td>Valor fixo em <strong>client_credentials</strong></td></tr><tr><td><strong>client_id</strong></td><td>Seu ID de cliente (enviar em formato string).</td></tr><tr><td><strong>client_secret</strong></td><td>Seu Client Secret (enviar em formato string).</td></tr></tbody></table>

Exemplo de requisição de token:

```json
curl
--location
--request POST 'https://core.scorepositivo.com.br/oauth/token' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw
'{
  "grant_type": "client_credentials",
  "client_id": "SEU_ID_AQUI",
  "client_secret": "SEU_SECRET_AQUI"
}'
```

Parâmetros de retorno:

<table><thead><tr><th width="287">Campo</th><th>Valor</th></tr></thead><tbody><tr><td>token_type</td><td>Fixo em <strong>Bearer</strong></td></tr><tr><td>expires_in</td><td>Tempo de expiração do token em segundos</td></tr><tr><td>access_token</td><td>Token de acesso utilizado nas requisições</td></tr></tbody></table>

Exemplo de retorno:

```json
{
    "token_type": "Bearer",
    "expires_in": 3600,
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxMDAwMDAxIiwianRpIjoiM2M4YzU0YmM5ZWQ4NDU3NmM1NDBkOWY4MzBiMzgxOGI3MTUwYzlhYzdmMGIxOWVmYjI0OGM4ZmZlYzIzNWI1MTcyOTQ2MTY0ZjMyZDhiNTUiLCJpYXQiOjE2OTg0Mzc3NDUuNjI2NzEsIm5iZiI6MTY5ODQzNzc0NS42MjY3MTYsImV4cCI6MTY5ODQzOTU0NS41OTg0OCwic3ViIjoiIiwic2NvcGVzIjpbXX0.QANc10VO27ZzQsbJAOsttWtHXwlQ0I75Q30veL8dB2-3--9peg2kMrXSpz831dau3RlDmtdmLuV-u93DZENsVnEAc3EY_J4Y92bWMgZy8P7OnRpwuiSLULfzLr1KI2Y96U9s7gNrpPCiT61S92l_zyXk26zocJhMDtGgPlL2uG6jxJxkYx8vak2UHgHTjhUsmiHQoTwFZX4A5atJMco9UF3t-TmP1e4u6v1EomO9vjClfBhBN6auG-DqTJ_Ul0NIZz70ocjwFg8CfIayocPKNStU7TnjIAAVoGklPnfqoSlqjF54AOa_7Wv3S87WTRGRBDaTiE6Y6Mqq1vxIaDWU1_ZznZBdD7RdboluXD-5UDqx0sxRFi6pZItXE3FKf1S9-w_FUVh14OImjqSg8NEMh95gxU9IwCKXCicpSLU_HDpJosG8I-dZRKiEdZFR9gqz8bf6QuNe2WLGak_FByjjjAUWyukYD50eWSVP4u09vFgipENnGQcRdZnqMFDm7nuqjM_LOs9jcSBaCHsahwyuO5z1OyQAGu8aAIu0gmzEU5clMSIJRO2t3llFwSU94uyHVN_9XlbzGux-_cKCxhshDC4Icpzxy8Mi_7YYRTBQBQryC6TzwdAYEixzJUbgO0sqsfSCMHMKqPVXPz9ge0M9R80HwFfXeJ1j9QjCDys2RWI"
}
```
