Azure Application Registration with permission
I was facing an issue with Azure Application authentication from OAuthHelper for the following case.
User-1 (member type) has created an application(i.e. AppB) on Azure Portal and grant the required permission(Microsoft Dynamics ERP, Windows Azure AD) and user-A can authenticate himself via OAuthHelper expected behavior [basic configuration need to set App-id, username, password in config file]
User-1 added user-2 from Azure Portal as application owner against the same application(i.e. AppB) and grant permission.
User-2 (member type) was unable to authenticate via OAuthHelper which was strange because User-1 already added him as application owner on Portal.
Exception faced: The user or administrator has not consented to use the application with ID <AppId> named AppB.
User-2 login on Azure Portal, select the same application(i.e. AppB), and press grant permission.
Now User-2 is able to authenticate via OAuthHelper no more exception
User-1 (member type) has created an application(i.e. AppB) on Azure Portal and grant the required permission(Microsoft Dynamics ERP, Windows Azure AD) and user-A can authenticate himself via OAuthHelper expected behavior [basic configuration need to set App-id, username, password in config file]
User-1 added user-2 from Azure Portal as application owner against the same application(i.e. AppB) and grant permission.
User-2 (member type) was unable to authenticate via OAuthHelper which was strange because User-1 already added him as application owner on Portal.
Exception faced: The user or administrator has not consented to use the application with ID <AppId> named AppB.
This exception raised when calling
authenticationResult = authenticationContext.AcquireTokenAsync(aadResource, aadClientAppId, userCredential).Result;
I did few hit and try. Following fix work for me.authenticationResult = authenticationContext.AcquireTokenAsync(aadResource, aadClientAppId, userCredential).Result;
User-2 login on Azure Portal, select the same application(i.e. AppB), and press grant permission.
Now User-2 is able to authenticate via OAuthHelper no more exception