I am trying to call Microsoft Graph using a JWT bearer token to call https://graph.microsoft.com/v1.0/me
At first, I was using the Azure OAuth v1 endpoint but the JWT it returned did not have the correct audience so it wouldn't let me call Microsoft Graph. Now, using the v2 endpoint but I'm getting an error:
"error_description": "AADSTS65001: The user or administrator has not consented to use the application with ID 'xxxxx' named 'MyAppName'. Send an interactive authorization request for this user and resource. Trace ID: xxxxx-xxxxx-xxxxxxx-xxxxxxxx Correlation ID: xxxxx-xxxxx-xxxxxxx-xxxxxxxx Timestamp: 2019-08-23 18:06:39Z"
I have set up the correct API permissions for my registered Application in AAD as best I can tell.
I'm stuck here and can't even try to test with the JWT that gets returned from v2.
Any ideas here? All the google hits tell me I need to set up my API permissions which you can see in the screenshot, I've done.
Here is the URL I'm first going to obtain my code
:
https://login.microsoftonline.com/xxxx-tentantidxxxx/oauth2/v2.0/authorize?client_id=xxxx-clientid-xxx&response_type=code&scope=https://graph.windows.net/directory.read.all%20https://graph.windows.net/user.read&redirect_uri=https://MyCoolsite.neat.com
https://graph.microsoft.com/.default
as scope, that will then use the permissions you have defined in the portal. – juunas