I'm trying to incorporate using of a API which has bearer Authentication type. I tried by passing Authentication in the headers section, but couldn't achieve it. And need some suggestions in generating the token dynamically.I have referred this below discussion.https://www.outsystems.com/forums/discussion/73029/api-expose-consume-add-authentication-using-bearer-token/But couldn't comprehend it properly. If someone could mention a step wise guide, it would be very helpful for many who are trying to achieve something similar.
Hello,
In your consumed REST API action you should add an input parameter that has the Send In value set to Header (see screenshot below):
When calling this API inside one of your server actions make sure to pass in the value as Bearer followed by a space and then your OAuth2 token.
Hope this helps,
Bogdan
thanks, this is very helpful
Do we have to whitelist this outsystems url? I gave this a try but was always getting 401.And could you also mention something regarding the token generating part?
Hey @Gowrisankar JG,
To Implement Dynamic API Auth there are a few methods possible i have implemented Microsoft Graph auth in the OML you can check it out
1) Create site properties to save auth tokens
2) Create a get token rest API to get the auth token using the client ID and secret or your preferred auth method3) to generate a new auth token add "OnBeforeRequest" and in headers append "authorization"
please make sure to use it safely and use proper authentication for the APIHope this helps
Regards,Kshitij Raheja
did you get the solution ?