593
Views
5
Comments
How to use JWT token in exposing and consuming API?
Application Type
Reactive
Service Studio Version
11.54.3 (Build 62213)

Hii Everyone,

Does anyone has a demo oml file of jwt for exposing and consuming API?

please share. 

2022-02-25 19-42-59
Srinivas K Singadi
AI Generated

Hello Priyam

OutSystems provides built-in functionality to expose and consume APIs, and it also has support for using JWT tokens to secure API calls.

Here are the high-level steps for using JWT tokens in OutSystems to expose and consume an API:

  • Generate a JWT token: You will need to generate a JWT token that contains the required information, such as the user ID, expiration time, and any custom claims you want to include.
  • Expose the API: Use the OutSystems API feature to expose the API you want to secure with the JWT token.
  • Secure the API: In the API definition, set the authentication type to "JWT token" and specify the secret key and other relevant information needed to validate the token.
  • Consume the API: In your OutSystems module that will consume the API, use the "REST" feature to make a REST call to the API endpoint.
  • Include the JWT token: In the REST call, add a header with the name "Authorization" and the value "Bearer {JWT token}" to include the JWT token in the request.
  • Validate the JWT token: In the API definition, OutSystems will automatically validate the JWT token and allow the request to proceed if it's valid. If the token is invalid or has expired, OutSystems will return an error response. 
This answer was AI-generated. Please read it carefully and use the forums for clarifications
2023-05-30 15-29-12
Priyam

Shrinivas if you have oml or oap regarding this please send it.

I am a beginner and I want a detailed explanation of it. 



2021-10-09 07-57-44
Stefan Weber
 
MVP

Hi, for protecting exposed APIs with OpenID you can check my article here https://medium.com/itnext/protect-outsystems-rest-apis-using-openid-connect-87a2ac7575c1

A sample for it is also available on the forge. Link is in the article.

Best

Stefan

2023-05-30 15-29-12
Priyam

Hii Stefan

can you give me an example of how to generate jwt token with outsystem users? 

2021-10-09 07-57-44
Stefan Weber
 
MVP

Hi. The JWT component on the forge https://www.outsystems.com/forge/component-overview/1853/jwt espcially its demo application and documentation provide guidance on how to create and sign a web token.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.