42
Views
4
Comments
Solved
How to Secure REST API with API Key and Username Between Two Apps?
Question

I am working on integrating two applications in OutSystems ( ODC ):

  • App A will expose a REST API.
  • App B will consume the REST API from App A.

For security purposes, I want to pass an API key and username in the API requests. I’ve already gone through the official documentation on adding custom authentication for exposed REST APIs. However, I’d appreciate any additional insights or examples.

Could anyone share ideas or, if possible, an OML file that demonstrates how to implement this securely?

2024-07-12 05-57-50
Gourav Shrivastava
Champion
Solution

You just need to pass the header while consuming the APi 

Like of you pass headers with value:-

ApiKey - 123456789

In the api logic you need to call get request header with the same text "AkiKey"

So it will return you the value of the apikey

2024-07-12 05-57-50
Gourav Shrivastava
Champion
Solution


This Post will help you just need to add header while consuming 



2024-07-12 05-57-50
Gourav Shrivastava
Champion

Hello @Dinesh M 

to check user-specific or API key-specific auth you can check it on the "OnAuthentication" action of API.

That belongs to OutSystems' best practice also

You just need to get the header and valiudate the value like below image 

2026-01-23 11-38-55
Dinesh Murugan
Champion

Thanks for sharing @Gourav Shrivastava . May I know the structure while consuming.

2024-07-12 05-57-50
Gourav Shrivastava
Champion
Solution

You just need to pass the header while consuming the APi 

Like of you pass headers with value:-

ApiKey - 123456789

In the api logic you need to call get request header with the same text "AkiKey"

So it will return you the value of the apikey

2024-07-12 05-57-50
Gourav Shrivastava
Champion
Solution


This Post will help you just need to add header while consuming 



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