Adal JS and Azure AD

I was recently following a Pluralsight tutorial called “Azure AD for Developers”. I’ve wanted to find out more about Azure AD (but was afraid to ask Winking smile) so I thought this video would be a good start. I followed the tutor and created the ASP.NET WebApi and Angular applications as he showed (I prefer to type everything than download the exercise files. You tend to find error messages and the solutions when you type everything yourself).

When I got to the point of testing I ran the apps and I could login to my app correctly but when I attempted to call an API it returned an error:

Error :interaction_required
adal.min.js:2 Error description:AADSTS65001: The user or administrator has not consented to use the application with ID ‘{GUID}’. Send an interactive authorization request for this user and resource.
Trace ID: {GUID}
Correlation ID: {GUID}
Timestamp: {TIME}

I spent a good amount of time looking over the video again, but the tutorial didn’t have any problems? Why was mine different? I checked I had used the correct App ID’s –the GUID’s were correct – the URL’s were correct?!?! What was going wrong!!

Then I found this web site:

https://blog.ithinksharepoint.com/2016/05/16/dev-diary-s01e06-azure-mvc-web-api-angular-and-adal-js-and-401s/

Although the post is a tutorial it also shows the possible pitfalls – including the one I had fallen into.

The error was in my Angular App where I had initialized the adalProvider. In my haste I had assigned my endpoints list to “endpoints”, but the ADAL property is called “endPoints”. D’oh! After changing this typo the API calls were returning correctly. Phew!

adal

I hope this post helps someone else fix this issue without the same amount of “googling” I had to do.

2 thoughts on “Adal JS and Azure AD

  1. Simon Doy 4 November, 2016 / 12:33 am

    Hi Ged,
    Thanks for the link back. Glad it was helpful, I had loads of fun with AdalJS and it took me a while to work it out.

    Look forward to seeing how things are going.

    Good luck.

    Cheers
    Simon

  2. Vikrant 18 January, 2017 / 10:42 am

    Thanks man, you saved our life…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s