Acquire token silently using ADAL JS

deepesh picture deepesh · Feb 12, 2016 · Viewed 8k times · Source

I have already established session with Azure AD through Open ID Connect, how do I acquire token silently from the browser, I mean without browser redirect, is it possible using ADAL JS?

Answer

vibronet picture vibronet · Feb 12, 2016

it is possible. If you are using Angular, all you need to do is specifying the resource you want to target at init time, in the endpoints structure - see https://azure.microsoft.com/en-us/documentation/samples/active-directory-angularjs-singlepageapp-dotnet-webapi/. If you aren't using Angular, you can use the lower level functions available in adal.js. In particular, see AuthenticationContext.prototype.acquireToken in https://github.com/AzureAD/azure-activedirectory-library-for-js/blob/master/lib/adal.js