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

# Autenticação

## Utilização via Auth Token (desenvolvimento)

No ambiente de desenvolvimento, o Auth Token simplifica a integração, podendo ser utilizado em todas as requisições sem a necessidade de renovação a cada consulta.

```
authToken={AUTH_TOKEN}
```

#### Fluxograma

{% @mermaid/diagram content="sequenceDiagram
participant Dev as Seu frontend
participant VoaAPI as API da Voa (Backend)
participant iFrame as iFrame Voa

```
Note over Dev,iFrame: Fluxo via Auth Token (Desenvolvimento)
Dev->>Dev: Obtém Auth Token (ex: variáveis de ambiente)
Dev->>iFrame: Requisição com header x-voa-token: {AUTH_TOKEN}
iFrame->>VoaAPI: Valida Auth Token
VoaAPI->>iFrame: Autorizado, responde com dados
iFrame->>Dev: Retorna resposta ao sistema do desenvolvedor
```

" %}

***

## Utilização via Bearer Token (produção)

Utilize este endpoint para obter um **Bearer Token** seguro através do seu **Auth Token.** Cada consulta requer um Bearer Token único, garantindo segurança e gerenciando o ciclo de vida do token de forma mais rigorosa. Este token é um JWT com expiração pré-definida, você pode alterá-la no campo `expiration` (segundos).

#### Request

```url
curl --request POST \
  --url https://api.voa.health/integration/identify/ \
  --header 'Content-Type: application/json' \
  --header 'x-voa-token: {AUTH_TOKEN}' \
  --data '{
	"consultation_id": {CONSULTATION_ID},
	"doctor_id": {DOCTOR_ID},
	"patient_id": {PATIENT_ID},
	"expiration": 43200
}'
```

#### Response

```
{ "token": "YOUR_TOKEN" }
```

#### Fluxograma

{% @mermaid/diagram content="sequenceDiagram
participant FrontDev as Seu frontend
participant BackDev as Seu backend
participant VoaAPI as API da Voa
participant iFrame as iFrame Voa

```
Note over BackDev,VoaAPI: Obter Bearer Token para cada consulta
BackDev->>VoaAPI: Dados consulta com x-voa-token: {AUTH_TOKEN}
VoaAPI->>BackDev: Retorna Bearer Token
BackDev->>FrontDev: Envia Bearer Token

Note over FrontDev,iFrame: Utilizar Bearer Token no iFrame
FrontDev->>iFrame: bearerToken na url do iFrame: Bearer {YOUR_TOKEN}
iFrame->>iFrame: Valida Bearer Token
iFrame->>FrontDev: Envia resposta com dados
```

" %}

***

### Suporte <a href="#suporte" id="suporte"></a>

Para questões técnicas ou suporte, entre em contato com nossa equipe de integração em <integration@voahealth.com>.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.voa.health/integracao/iframe/autenticacao.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
