Digibee JWT implementation

Learn how to use the Digibee JWT connector on the Digibee Integration Platform.

The Digibee JWT connector is most commonly used to authorize access to a service exposed on the network via the HTTP protocol. To access these services, it’s necessary to log in using a pipeline, which will be responsible for generating the JWT token. With this token, you have access to permitted routes, services, and resources.

Step 1 - Creating a pipeline for authentication and JWT generation

The first step to create an authentication pipeline is to configure the trigger to login:

  1. On the Digibee Platform home page, open the Build page.

  2. Click Create and then select Pipeline.

  3. Inside the Canvas, click on the Configurations icon on the trigger.

  4. In the trigger configuration, select REST.

  5. Activate the External API and API Key options and configure the rest as desired. After configuring the trigger, add the Digibee JWT connector to your integration.

  6. Click the + button next to the trigger and search for the connector Digibee JWT or drag the connector to your Canvas.

  7. Open connector settings and select Generate operation to create the token.

  8. In the Scopes field, set the scopes for the JWT token, separated by comma.

  9. In the Expiration field, set the token expiration time (in milliseconds). The maximum expiration is 365 days (31536000000 milliseconds).

  10. Click Confirm to implement the connector settings.

JWT token generation is not done in test mode. This is only possible when the pipeline is published in one of the environments (Test or Prod).

Stage 2 – Using the Assert v2 connector

Use the connector Assert v2 to create a validation using a pre-registered username and password on the Digibee Integration Platform by following the steps below:

  1. Click the + button next to the Digibee JWT connector and search for the Assert V2 connector or drag the connector to your Canvas.

  2. Open the connector settings and enter the following code in the Condition field:

#{body.user} == #{globals.user} && #{body.password} == #{globals.password}
  1. Click Confirm to implement the connector setting.

Step 3 - Calling the pipeline for login

After you finish the configuration, you need to deploy the pipeline in your appropriate test or production environment to test the flow. Learn more about deploying pipelines on the Platform.

With the API Key configured, you can start testing. See in the following example how to do this using Postman. You can also use the client you typically use or any other application you prefer.

To perform the operation in Postman:

  1. Provide the API Key in the header of the request.

  2. Provide the username and password configured in step 2 as mandatory in the flow.

When this request is made, the service returns a successful status:

  1. Search for the necessary information in the headers of the response, in the Authorization field. This is the authentication, which means that the generated JWT that will be used in combination with the API Key for other flows that use the REST API and HTTP triggers.

Configuring the trigger for flows with new key-based authentication

With Digibee JWT, you can customize security in the construction of your next pipeline projects. Make the necessary adjustments in the trigger following the instructions below:

  1. On the Digibee Integration Platform home page, open the Build page.

  2. Click Create and then select Pipeline.

  3. Inside the Canvas, click on the Configurations icon on the trigger.

  4. In the trigger configuration, select REST.

  5. Activate the External API, API Key, and Token JWT options. This way, whenever routes are called, it will be necessary to inform the API Key and the JWT token generated. If you just inform the API Key without the token, an authorization error will be returned:

Last updated