I need to integrate a external webservice to retrieve data. But I need to first authenticate Dynamics CRM to the external Web Service. The Web Service uses oAuth 2.0 and it needs a return URL. I have searched a lot but couldn't figure out how to do it.
Steps I need to perform
1. Have a Configuration Entity with custom fields which stores the client id etc.
2. Have a Web Page call the External Web Service authentication URL.
3. Pass in the credentials.
4. Once Authenticated, the webservice would call a return URL with the access token + refresh token etc etc.
5. Dynamics CRM is now authorized to access the external web service using the access token.
What I cannot figure out..
1. How can the redirection works.
2. How do I trigger Dynamics CRM to get new Access Token before the validity expires.
We will be testing with both Dynamics 365 and On-Prem.