# OAuth - Azure AD

**URL:** <https://forum.radzen.com/t/oauth-azure-ad/856>\
**Category:** Uncategorized\
**Created:** [January 25, 2019, 10:08pm UTC](https://forum.radzen.com/t/oauth-azure-ad/856 "2019-01-25T22:08:45Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![joshbooker](https://forum.radzen.com/user_avatar/forum.radzen.com/joshbooker/32/12624_2.png) [@joshbooker](https://forum.radzen.com/u/joshbooker)\
**Post date:** [January 25, 2019, 10:08pm UTC](https://forum.radzen.com/t/oauth-azure-ad/856/1 "2019-01-25T22:08:46Z")

</div>

Atanas,

I broke out RadZen today to try [to connect to CDS\DynamicsCRMOnline](https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/setup-postman-environment) but I had no luck with OAuth. It works fine in Postman with the exact same parameters, but RadZen hangs with an blank auth pop-up:

 ![image](https://forum.radzen.com/uploads/default/original/1X/22885b6ade27c3f9c9611a4296314fd6778704c0.png)

Both requests are the same except Postman encodes the query string:

Postman:

GET /common/oauth2/v2.0/authorize?response\_type=token&state=&client\_id=55342314-c2d4-48a5-a72a-4ad90803d4a0&scope=https%3A%2F%[2Fadmin.services.crm.dynamics.com](http://2Fadmin.services.crm.dynamics.com)%2Fuser\_impersonation&redirect\_uri=http%3A%2F%2Flocalhost%3A8000 HTTP/1.1

RadZen:

GET /common/oauth2/v2.0/authorize?client\_id=55342314-c2d4-48a5-a72a-4ad90803d4a0&response\_type=token&redirect\_uri=[http://localhost:8000/&amp;scope=https://admin.services.crm.dynamics.com/user\_impersonation](http://localhost:8000/&amp;scope=https://admin.services.crm.dynamics.com/user_impersonation) HTTP/1.1

The response is indeed the same for both: 302 with access\_token=...

I compared this to your MSGraph example and don’t see any difference in the OAuth setup. I’ve tried every way I know of – both OAuth and Azure AD options in RadZenand all sorts of different app reg in Azure AD.

I cannot get it to work in RadZen, yet it does indeed work in Postman.

Any ideas how to troubleshoot?

PS: I also cannot get the following to work in RadZen although it does pickup token in Postman (resource param provided instead of scope)

> **[Sign in to your account](https://login.microsoftonline.com/common/oauth2/authorize?resource=https:%2F%2Forg62bce5c9.crm.dynamics.com%2F&amp%3Bresponse_type=token&amp%3Bstate=&amp%3Bclient_id=51f81489-12ee-4a9e-aaae-a2591f45987d&amp%3Bscope=&amp%3Bredirect_uri=https%3A%2F%2Fcallbackurl)**

PSS: It would be nice if you could add a callback URL to the OAuth\AzureAD configuration. It seems RadZen assumes [https://localhost:8000](https://localhost:8000), correct?

PSS: I just restarted RadZen and now I get this:

 ![image](https://forum.radzen.com/uploads/default/original/1X/6fcf4006501627cfbad25d4d5c25617ee3f191e4.png)

Thank in advance for your advice. Have a great weekend!

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [January 26, 2019, 7:51am UTC](https://forum.radzen.com/t/oauth-azure-ad/856/2 "2019-01-26T07:51:48Z")

</div>

Azure AD authentication has subtle differences from the OAuth standard. This is why Radzen has a separate kind of authentication supposed to handle Azure AD - it is the **Azure AD** option right after **API Key**.

Have you tried [the official Radzen instructions for connecting to Dynamics CRM](https://www.radzen.com/documentation/dynamics/)? Those are supposed to work.

---

<div class="post-metadata">

**Author:** ![joshbooker](https://forum.radzen.com/user_avatar/forum.radzen.com/joshbooker/32/12624_2.png) [@joshbooker](https://forum.radzen.com/u/joshbooker)\
**Post date:** [January 26, 2019, 2:32pm UTC](https://forum.radzen.com/t/oauth-azure-ad/856/3 "2019-01-26T14:32:14Z")

</div>

I did not see that article but yes I’ve tried the single tenant auth url with resource param. That too works in Postman but get blank pop up in RadZen.

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [January 26, 2019, 3:01pm UTC](https://forum.radzen.com/t/oauth-azure-ad/856/4 "2019-01-26T15:01:35Z")

</div>

What happens when you try the instructions from the Radzen documentation? The first step (enabling JS access for the Dynamics app) is crucial. Postman isn't a browser and doesn't need the JS access. Unfortunately one cannot build an application with Postman - only test HTTP requests that do not obey the same origin policy which browsers follow.

---

<div class="post-metadata">

**Author:** ![joshbooker](https://forum.radzen.com/user_avatar/forum.radzen.com/joshbooker/32/12624_2.png) [@joshbooker](https://forum.radzen.com/u/joshbooker)\
**Post date:** [January 26, 2019, 3:12pm UTC](https://forum.radzen.com/t/oauth-azure-ad/856/5 "2019-01-26T15:12:04Z")

</div>

Those instructions are the same for registering any app in AzureAD. Unless I’m missing something I did the same as I always do for SPAs. Implicit flow is true etc etc. I did not do anything with CORS though. Is that where Postman differs? I just wish there was a way to know what failing in RadZen. I can see the token response so why the hang?

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [January 26, 2019, 3:48pm UTC](https://forum.radzen.com/t/oauth-azure-ad/856/6 "2019-01-26T15:48:46Z")

</div>

We can't tell why the hang is happening until we reproduce it 🙂

I suggest you double check the [Dynamics app registration steps](https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/walkthrough-registering-configuring-simplespa-application-adal-js#register-the-application). The app settings in the Azure portal should look like this:

[![](https://www.radzen.com/documentation/dynamics-azure.png) ](https://www.radzen.com/documentation/dynamics-azure.png)

CORS access is needed because browsers follow the same origin policy and will not make cross-domain HTTP requests from JavaScript unless the server supports CORS.

Then check your OData settings in Radzen. Should look like this:

[![](https://www.radzen.com/documentation/dynamics-data-source.png) ](https://www.radzen.com/documentation/dynamics-data-source.png)

---

<div class="post-metadata">

**Author:** ![joshbooker](https://forum.radzen.com/user_avatar/forum.radzen.com/joshbooker/32/12624_2.png) [@joshbooker](https://forum.radzen.com/u/joshbooker)\
**Post date:** [January 26, 2019, 4:05pm UTC](https://forum.radzen.com/t/oauth-azure-ad/856/7 "2019-01-26T16:05:25Z")

</div>

Thanks for your reply. My app Reg and OData settings match. I’ve tried dozens of times. Do I have to clear cache or close all browsers or something?

Maybe for CORS to work, you have to be using Adal.js, no?

> **[Use OAuth with Cross-Origin Resource Sharing to connect a Single Page...](https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/oauth-cross-origin-resource-sharing-connect-single-page-application)**
>
> Learn how to use OAuth with Cross-Origin Resource Sharing to connect a Single Page Application

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [January 26, 2019, 4:12pm UTC](https://forum.radzen.com/t/oauth-azure-ad/856/8 "2019-01-26T16:12:36Z")

</div>

Radzen doesn't need Adal.js. Can you paste a screenshot of your OData settings from Radzen?

---

<div class="post-metadata">

**Author:** ![joshbooker](https://forum.radzen.com/user_avatar/forum.radzen.com/joshbooker/32/12624_2.png) [@joshbooker](https://forum.radzen.com/u/joshbooker)\
**Post date:** [January 26, 2019, 4:27pm UTC](https://forum.radzen.com/t/oauth-azure-ad/856/9 "2019-01-26T16:27:18Z")

</div>

This is a brand new app reg. the auth pops up then I login and it goes blank and hangs.

 ![image](https://forum.radzen.com/uploads/default/original/1X/051f5a0a63ebf26a82323b7f149ac0acff073801.png)

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [January 26, 2019, 4:29pm UTC](https://forum.radzen.com/t/oauth-azure-ad/856/10 "2019-01-26T16:29:40Z")

</div>

I tried the settings from your original screenshot:

 ![37](https://forum.radzen.com/uploads/default/original/1X/8a234b3f1e924bfb6df402e77ec230be7c88087b.png)

The login screen still appeared but displayed this error:

 ![59](https://forum.radzen.com/uploads/default/original/1X/e9d17acdb3ba30e8b85a43e5c728fbdd320ab919.png).

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [January 26, 2019, 4:33pm UTC](https://forum.radzen.com/t/oauth-azure-ad/856/11 "2019-01-26T16:33:48Z")

</div>

Please paste the values from the configuration screen so I can try them locally:

Rest endpoint,  
ClientID,  
Authorization URL  
Resource

---

<div class="post-metadata">

**Author:** ![joshbooker](https://forum.radzen.com/user_avatar/forum.radzen.com/joshbooker/32/12624_2.png) [@joshbooker](https://forum.radzen.com/u/joshbooker)\
**Post date:** [January 26, 2019, 4:34pm UTC](https://forum.radzen.com/t/oauth-azure-ad/856/12 "2019-01-26T16:34:53Z")

</div>

![rzAAD](https://forum.radzen.com/uploads/default/original/1X/6584dcd4cff1525db5af6f25a2eb50240b1bbfbf.gif)

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [January 26, 2019, 4:37pm UTC](https://forum.radzen.com/t/oauth-azure-ad/856/14 "2019-01-26T16:37:48Z")

</div>

Can you also temporarily give access to that resource to the [atanas@radzen.com](mailto:atanas@radzen.com) Live account? I want to try logging in to see what happens.

---

<div class="post-metadata">

**Author:** ![joshbooker](https://forum.radzen.com/user_avatar/forum.radzen.com/joshbooker/32/12624_2.png) [@joshbooker](https://forum.radzen.com/u/joshbooker)\
**Post date:** [January 26, 2019, 4:56pm UTC](https://forum.radzen.com/t/oauth-azure-ad/856/15 "2019-01-26T16:56:07Z")

</div>

Thanks again. Sent you creds via email.

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [January 28, 2019, 9:25am UTC](https://forum.radzen.com/t/oauth-azure-ad/856/16 "2019-01-28T09:25:31Z")

</div>

This turned out to be a regression in Radzen - Azure AD authentication stopped working in design time. We will release a hotfix soon.

---

<div class="post-metadata">

**Author:** ![joshbooker](https://forum.radzen.com/user_avatar/forum.radzen.com/joshbooker/32/12624_2.png) [@joshbooker](https://forum.radzen.com/u/joshbooker)\
**Post date:** [January 28, 2019, 1:55pm UTC](https://forum.radzen.com/t/oauth-azure-ad/856/17 "2019-01-28T13:55:02Z")

</div>

Thanks. Perhaps affecting this post as well.

> [@Azure AD API as data source](http://forum.radzen.com/t/azure-ad-api-as-data-source/728/9):
>
> There is really nothing to the app at the moment; this issue came up as we were trying to connect to an existing API. The API is part of an existing system that we cannot share with you. We could set up a hello world API but in the short term I can describe it's setup which may shed some light: The API uses an Azure AD App Registration with normal grant flow (Client ID and Secret). This client (and other clients) use a separate Azure AD App Registration, which in this case is set to use impli…

---

<div class="post-metadata">

**Author:** ![Andrew\_Mee](https://forum.radzen.com/user_avatar/forum.radzen.com/andrew_mee/32/11612_2.png) [@Andrew\_Mee](https://forum.radzen.com/u/Andrew_Mee)\
**Post date:** [September 3, 2022, 9:03am UTC](https://forum.radzen.com/t/oauth-azure-ad/856/18 "2022-09-03T09:03:30Z")

</div>

Was there a fix for this as I get the same issue trying to connect to Dynamics, and postman works fine.
