I was facing issue on Azure Application authentication from OAuthHelper for following case.
User-1 (member type) has created application(i.e. AppB) on Azure Portal and grant the require 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 same application(i.e. AppB) and grant permission.
User-2 (member type) unable to authenticated 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 :)
D365 Integration Details
User-1 (member type) has created application(i.e. AppB) on Azure Portal and grant the require 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 same application(i.e. AppB) and grant permission.
User-2 (member type) unable to authenticated 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 :)
D365 Integration Details