In my previous blog, I have explained on how to authenticate your Dynamics 365 portals with Azure Active Directory. You can read it here – https://debajmecrm.com/2017/06/12/dynamics-365-portal-authentication-with-external-identities-part-i-authentication-with-azure-active-directory/
However these days it’s common to come across websites which have options to sign-in with Google and Facebook.
Why are lovely portals be behind in this. And in case you are unaware, D365 portals has the support to configure this kind of authentication with Google and Facebook in a very simple way. So let’s explore on how to do this.
Step 1: Register your portal with Google API’s
Go to Google API Console – https://console.developers.google.com/projectselector/apis/library
Click on Credentials
In Create Credentials dropdown, Click on OAuth Client.
In the screen that comes up, Enter the below details
Name – This can be anything you want. I have named it as Microsoft portal identifier.
Authorised redirect URIs – This is basically the call back URL once the validation is successful. As you can see I have entered https://xrmtr1.microsoftcrmportals.com/oauth2callback
Click on Save.
Once saved, you could see your client_id and client_secret. We do not need the client secret here. Just keep a note of the client id.
Step 2: Modify the Site Settings in Dynamics CRM
Go to CRM-> Portals-> Site Settings.
We need to create three site settings records here.
The first record would be identify the Authority URI from where we need to get the token.
I have put the name as – Authentication/OpenIdConnect/Google Sign In/Authority. The part in bold is basically the name of the button as you want to show up in the login screen.
Second record of Site settings is to capture the value of the Client ID registered with the Google API’s
The third record is to capture the value of the redirect URI. This is the same value that you should put while registering D365 portal in Google API in Step 1.
And you are done.
Now when you try to register in your CRM portal, you could see the magical ‘Google Sign In’ button. Whooo. it was so complex
Any body with a Google account can now register with your portal.
You would be asked for consent as per OAuth 2.0 protocol.
Once you provide your email and click on ‘Register’ you are done.
So simple and yet so powerful extensibility for your portals.
Hope you liked this post.
-Debajit Dutta (Dynamics MVP)
For Training and consulting please visit www.xrmforyou.com
(Visit our products page – http://www.xrmforyou.com/products-1.html to know more about our offerings)