rony l
rony l

Reputation: 6022

does adal.js support Authorization Code Grant Flow?

For a while now I had a .Net WPF application that uses Adal.Net to perform (what i believe is) an Authorization code grant flow against azure active directory to access a web API (which is looking for a bearer token in the request).

For this purpose I'm using 2 AAD applications: MyServer (which represents the server) and MyClient (which represents the WPF client). In the azure portal I configued Myclient with permission to access MyServer.

When calling AcquireToken from my WPF application i'm supplying MyClient.ClientId as the client ID and MyServer.ResourceUrl as the resource id, and everything works as expected.

Now I have a website (that only serves static pages using IIS - it does not have asp.net nor node.js as web servers).

I would like to my browser to perform the same flow the .Net native app performed.

I've looked at adal.js but wasn't able to find an easy way to do it.

Must I implement the entire flow by hand?

Upvotes: 1

Views: 1991

Answers (1)

Dushyant Gill
Dushyant Gill

Reputation: 4004

Rony, AAD doesn't support cross origin calls on the token endpoint - so you won't be able to implement the auth code grant OAuth flow in JS (the token request using the code will fail). AAD supports the implicit grant OAuth flow for the scenario you describe (single page app calling a web api).

ADAL.js implements the implicit grant flow. Please let us know if you have any issues using it.

Hope that helps.

Upvotes: 3

Related Questions