The third party system that I am trying to connect to has following authentication mechanism:
Step 1: We have been provided with a
X-Api-User
andX-Api-Secret
to be included in header. Other header information is:Accept-Charset: utf-8
andContent-Type: application/json
. Once we hit an endpoint(POST call) with this data, we get a "token". Authentication : No Auth.
Step 2: Hit another endpoint with above fetched token included in header along with relevant details in body of request. This returns us the required data.
This token is valid for 30 days.
Questions:
- Can I use Named credentials in such a scenario? If so how?
- How to handle expiry and refresh of authentication token if we use NC?
I can achieve this with traditional method of storing credentials in Custom Metadata and programmatically checking timestamp to get refreshed token etc. Just want to check if we can use more secure way like Named Credentials in such a scenario.