I have an cordova mobile application where it has login phase using MICROSOFT ADAL, When I try logging in using organization account I face issue as Need admin approval and it says Application needs permission to access resources in your organization that only an admin can grant.
Part of code used:
var authority = "https://login.windows.net/common/adminconsent?clientId&redirect_uri=http://localhost:3000/";
var resourceUri = "https://graph.microsoft.com";
var clientId = "xyz";
var authContext = new $window.Microsoft.ADAL.AuthenticationContext(authority);
authContext.acquireTokenAsync(resourceUri, clientId, "https://login.microsoftonline.com/common/oauth2/nativeclient")
.then(function (authResponse) {
console.log("New Login")
At first I tried using
https://login.windows.net/common
and later tried with this
https://login.windows.net/common/adminconsentclientID&redirect_uri=http://localhost:3000/
I've made used Active Directory Authentication Library (ADAL) plugin for Apache Cordova apps
Want the application to gets logged in using organization account.Thanks in advance.
1.Use https://login.windows.net/common
as the authority.
2.Grant admin consent. Here are two options.
Use Azure portal.
You can refer to my answer here.
Build the consent URL.
Go to a URL such as https://login.microsoftonline.com/tenant-id/oauth2/authorize?client_id=app-client-id&redirect_uri=encoded-reply-url&response_type=code&prompt=admin_consent.
Use your admin account to consent the permissions.