Webhook Registration with Token Authentication - JWT
In this article you will learn how to:
- O que é autenticação JWT?
- Por que usar o JWT?
- Como funciona a autenticação de JWT nos webhooks da Celcoin?
Prerequisites for implementation
- Have a Celcoin API key, for more information access this link
- Have familiarity with the REST standard using the OAuth 2.0 protocol.
- Have the product/solution contracted and enabled in production.
- If you want to use the functionality in a production environment, please contact our sales team via email at [email protected]. For technical questions, simply contact support via the link .
O que é Autenticação JWT?
JWT (JSON Web Token) é um método para realizar autenticação entre duas partes por meio de um token assinado que autentica uma requisição web. Esse token é um código que armazena objetos JSON com os dados que permitem a autenticação da requisição.
Por que Usar o JWT?
Ao utilizar o JWT, adicionamos uma camada a mais de segurança na troca de mensagens da aplicação, garantindo que somente requisições autorizadas e autenticadas cheguem até você, ou seja aumentando a segurança e confiabilidade.
Como funciona a autenticação JWT nos webhooks da Celcoin?
Na API da Celcoin, essa funcionalidade está disponível na chamada de Registrar Webhook Com Token
Modelo de requisição do registro da autenticação JWT
cURL
{ "url": "https://gatilho.com.br", "url_token": "https://gerartokengatilho.com.br", "client_id": "d35f22170e.meucarrosemdebito.celcoinapi.v5", "client_secret": "777f7e971374e03ae92128c10ab45e677oi5ce97f684fde8c527b123456789f", "content_type": "application/x-www-form-urlencoded", "token_type": "Bearer", "grant_type": "client_credentials", "token_field": "access_token", "handles": [ { "name": "Escope", "value": "Débito Veicular" } ] }
The data provided in the request template is for example purposes only.
Return model
JSON
{ "message": "Nova URL atualizada com sucesso", "errorCode": "000" }
Após o cadastro já será possível a Celcoin autenticar em seu ambiente e você receber as notificações do produto de Débito Veicular.
Descriptive Table of Request Fields:
| Field | Description | Type | Mandatory |
|---|---|---|---|
| url | Endereço para recebimento de mensagens assíncronas. | String | True |
| url_token | Service address for token generation | String | True |
| client_id | Identificação única para integração com a plataforma. | String | True |
| client_secret | Chave privada para a integração com o serviço. | String | True |
| content_type | The type of content that will be sent to the token service address. Ex: application/json or application/x-www-form-urlencoded | String | True |
| token_type | Tipo do token. Ex:. Bearer | String | True |
| grant_type | Used in token refresh scenarios. Ex: client_credentials | String | True |
| token_field | Name of the token field in the generation request return for internal storage. | String | True |
| handles | Object to identify some internal process. Ex: Product, Project Scope, Team, Service, etc. | List<KeyValuePair<String, String>> | False |