Hi Aditya Bhat,
For what I understand are you retrieving an access token from an Identity Provider (IdP) which use can use to authenticate at another API, the service provider (SP).
The response of retrieving such an access token mostly looks like a JWT:
{
"access_token":"eyJz93a...k4laUWw",
"token_type":"Bearer",
"expires_in":86400
}
You can create an import mapping within Mendix to store these values in an object, let's call this $AccessTokenResponse and then use this in your next call by using the access_token attribute.
In a plain "Call REST" activity, you need to add an HTTP Header name 'Authorization' and fill this with
'Bearer ' + $AccessTokenResponse/access_token
In Mendix 10.21, you can use a Consumed REST Service, as Paul says. You then first add a parameter, which you call for example access_token, and then add a header Authorization with the value Bearer {access_token}, see screenshots below. This makes reuse easier if you want to call multiple endpoints of this service provider API.
Good luck!
If it is an OAuth2.0 authorization flow you can also take a look at: https://stephanbruijnis.dev/docs/how-to/connect-your-mendix-application-to-apis-secured-with-oauth-2.0-authorization/ which describes the concepts and steps required to get an authorization code, and the bearer tokens (access+refresh token).
Wij van WC-eend adviseren WC-eend =)
Hello Aditya,
Please check this if help.
Configuring REST services in Mendix | by Ryan Mocke | Mendix Community | Medium