c# - Microsoft Graph Client not specified resource in requiredResourceAccessList -
i following error when try retrieve accesstoken.
/microsoftgraph/authorise?error=access_denied&error_description=aadsts65005%3a+the+client+application+has+requested+access+to+resource+%27https%3a%2f%2fgraph.microsoft.com%2f%27.+this+request+has+failed+because+the+client+has+not+specified+this+resource+in+its+requiredresourceaccess+list.%0d%0atrace+id%3a+7cd46ad3-d294-41ad-98ec-6ef06db7a0db%0d%0acorrelation+id%3a+4e2a6d3b-b3dd-4a98-b36d-550d8f8c3382%0d%0atimestamp%3a+2016-01-27+10%3a40%3a12z
which is... graph.microsoft.com request has failed because client has not specified resource in requiredresourceaccess list
it multitenant application in azure active directory. able login 1 of email ids not one.
where going wrong? missing?
code snippet:
public actionresult login() { .... uri authuri = authcontext.getauthorizationrequesturl( microsoftgraphsettings.o365unifiedapiresource, microsoftgraphsettings.clientid, loginredirecturi, useridentifier.anyuser, null); string authuriasstring = authuri.tostring(); return redirect(authuriasstring); } public async task<actionresult> authorise() { uri loginredirecturi = new uri(url.action("authorise", "microsoftgraph", null, request.url.scheme)); var authcontext = new authenticationcontext(microsoftgraphsettings.azureadauthority); var authresult = await authcontext.acquiretokenbyauthorizationcodeasync( request.params["code"], loginredirecturi, new clientcredential(microsoftgraphsettings.clientid, microsoftgraphsettings.clientsecret), microsoftgraphsettings.o365unifiedapiresource); }
i have tried following
public static string o365unifiedapiresource = @"https://graph.microsoft.com/"; //public static string o365unifiedapiresource = @"https://graph.windows.net/";
using second one, authentication succeeds whenever use existing code access list of files in onedrive business account or create text file, throws unauthorized exception while making api call.
that error message indicates application doesn't have delegated permissions "microsoft graph" (https://graph.microsoft.com/) resource.
please use azure management portal (https://manage.windowsazure.com) configure delegated permissions resource. find app -> configure -> "permissions other applications" -> "add application" -> select "microsoft graph".
since you're able token "https://graph.windows.net/" application has permissions configured "windows azure active directory" resource, different resource "microsoft graph".
Comments
Post a Comment