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

# Autenticação via Token

## Introdução

Esse manual descreve o procedimento de autenticação via Token do SPID Client com o SPID Server.

## Procedimento

Acesse o servidor onde do SPID Server, entre no arquivo `user.json`. Neste arquivo, faça a adição de usuário e senha ou edite algum usuário que não comprometerá no funcionamento do SPID. Note que a senha deve estar encriptada em SHA-256.

{% hint style="info" %}
Em caso de dúvidas, contate o Time de Suporte da Griaule.
{% endhint %}

Exemplo de como a seção do arquivo deverá estar, considerando um usuário chamado “griaule” e a senha “teste”:

```json
{
	"user": "griaule",
	"pass": 46070d4bf934fb0d4b06d9e2c46e346944e322444900a435d7d9a95e6d7435f5,
	"role": [
		"ROLE_ADMIN",
		"ROLE_USER"
	]
}
```

{% hint style="warning" %}
Não remova os outros usuários deste arquivo, a remoção poderá comprometer o funcionamento da aplicação.
{% endhint %}

Na máquina do SPID Client, acesse `C:\Griaule\SPID_Griaule\jre\bin` e execute o arquivo encrypt.jar com a senha escolhida no passo anterior.

```sh
.\java.exe -jar .\encrypt.jar teste
```

Se tudo ocorrer corretamente, a resposta deverá ser, para a senha `teste`:

```
Encrypted password is: 2JnIAzJa4ZwiamcKOAnJNg==
```

Acesse o arquivo `GBSSpid2.properties` na pasta `C:\Griaule\SPID\conf\` e insira a senha criptografada no campo `server.password`.

```properties
#GBDS Server connection
server.url=<URL>
server.username=griaule
server.password=2JnIAzJa4ZwiamcKOAnJNg==
```

Na máquina do servidor, reinicie o SPID Server.

```sh
sudo service spid restart
```

Abra o SPID Services, se o processo for bem sucedido, o servidor mostrará a seguinte mensagem:

```json
{
	"event": "Authorization",
	"eventResult": "JWT Token Authorized"
}
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.griaule.com/psbio/spid/spidtoken.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
