I'm attempting to integrate with a third party external service, and I can't find the right mechanism to use for authentication.
The third party requires a callout to a REST endpoint with a username and password, and this returns a token that is valid for a specific period of time, in seconds. This token (rather than the username and password) then needs to be sent in the request header for all subsequent requests. The third party doesn't support an OAuth authentication method, and it's just an access token and no refresh token that is provided in the response.
I've created a Named Credential with Password authentication, and I am able to request the initial token. However, any callouts using the Named Credential to any other of their service calls fail as the username and password is still being used.
Is there a way of setting up the Named Credential to store and use the returned token, or will I need to look at taking the returned token and storing it in a Custom Setting, or Custom Metadata element and just using the Named Credential for the authentication callouts?
Thanks,
Rory.