# Autenticação de Usuário

### Autenticação de Usuário

Refere-se à mesma API de autenticação de usuário consumida pelo portal.

<table data-header-hidden><thead><tr><th width="190"></th><th></th></tr></thead><tbody><tr><td><strong>URL</strong></td><td><code>/auth</code></td></tr><tr><td><strong>Methods</strong></td><td><code>POST</code></td></tr><tr><td><strong>Data Params</strong></td><td></td></tr><tr><td><code>username</code></td><td><code>String</code> | Requerido | Identificação do usuário por meio de CPF.</td></tr><tr><td><code>password</code></td><td><code>String</code> | Requerido | Valor do OTP obtido no aplicativo BirdID.</td></tr><tr><td><code>grant_type</code></td><td><code>String</code> | Requerido | Informar o valor <code>password</code></td></tr><tr><td><code>lifetime</code></td><td><code>Number</code> | Requerido | Valor que indica o tempo de vida desejado para o token a ser gerado em segundos. Não deve ultrapassar (7 dias)</td></tr><tr><td><code>scope</code></td><td><code>String</code> | Requerido | Informar o valor <code>application_ext</code></td></tr><tr><td><strong>Success Response</strong></td><td><p><strong>Code:</strong> <code>201</code></p><pre class="language-json"><code class="lang-json">{
    "access_token": "5febf3bc80a6615ad2fecbcae61670bf9e123a98",
    "token_type": "bearer",
    "provider_environment": "bird",
    "corporations": [
        {
            "id": 9,
            "name": "Corporação Teste Ltda.",
            "cnpj": "33837169000150"
        }
    ],
    "roles": [
        "user"
    ],
    "_links": {
        "self": {
            "href": "https://billing.hom.vaultid.com.br/auth"
        }
    }
}
</code></pre></td></tr><tr><td><strong>Error Response</strong></td><td><p><strong>Code:</strong> <code>400</code><br><strong>Content:</strong> </p><pre class="language-json"><code class="lang-json">{
    "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
    "title": "invalid_grant",
    "status": 400,
    "detail": {
        "code": 1056,
        "status": "INVALID_CREDENTIALS",
        "message": "Invalid credentials"
    }
}
</code></pre></td></tr></tbody></table>

#### **Exemplo**

```sh
curl --location 'https://billing.hom.vaultid.com.br/auth' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
    "username": "83164833865",
    "password": "696439",
    "grant_type": "password",
    "scope": "application_ext",
    "lifetime": 86400
}'
```

### Ambientes

* Homologação: [https://billing.hom.vaultid.com.br](https://billing.hom.vaultid.com.br/auth)
* Produção: [https://billing.vaultid.com.br](https://billing.vaultid.com.br/auth)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.vaultid.com.br/workspace/wings/autenticacao/autenticacao-de-usuario.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
