Hi guys.
We are working on integrating CRM online with custom web api services. There is some quite sensitive data flying between them.
We use https and basic authentication with store credentials in custom configuration entity. We aren't really happy with storing credentials inside CRM for obvious security consideration.
What we would like to use is some oauth\jwt S2S approach from plugins\activities. Looks like MS has already some S2S token authentication for integration with Sharepoint, Exchange etc, but that S2S authentication isn't available for custom code.
There are plenty examples of how to use S2S auth to access CRM from custom services by registering application user in Azure AD. But I couldn't really find any way to acquire any token or identity inside plugins\activities code. Something like:
var tokenService = executionContext.GetExtension<ITokenService>(); var token = tokenService.GetOAuthToken();
On receiving side I would validate that token come from specific tenant Azure AD.
Could you share your experience for authenticating CRM calls in your custom services?
*This post is locked for comments