Hello,
Unfortunately OAuth2 authentication for REST Client is not available out of the box for now.
But an enhancement request already exists on the topic: MDM-11500.
So at this point, there is no best practices around it, just workarounds.
Which yours seems very promising.
Anna
What is the best practice for OAuth2 authentication for xDM REST Clients?
Since OAuth2 is a standard authentication method for REST APIs, what's the correct way to retrieve a new token and force xDM to get a new token when the token expires?
Right now, I am using custom SQL functions to generate the encoded credentials and sending it to get a token. Then I have a custom SQL procedure to get a new token every time the REST API is called even if the current token hasn't expired. It feels very hacky and is brittle.
I would prefer a more robust way to handle authentication.
Thank you in advance.