Graph api user authentication failing

-- -- 882 Reputation points
2021-04-24T01:02:28.8+00:00

Hi

I am testing out the GraphTutorial app (https://github.com/microsoftgraph/msgraph-training-dotnet-core/tree/main/demo).

I run the app, go to https://microsoft.com/devicelogin, enter the provided code, sign in with a user login and I get the page that says 'You have signed in to the My App application on your device. You may now close this window'.

Next comes the following statement;

    return await graphClient.Me
                    .Request()
                    .Select(u => new{
                        u.DisplayName,
                        u.MailboxSettings
                    })
                    .GetAsync();

and it gives me the 'Access is denied. Check credentials and try again' exception. I have tried with two different users with one being global admin but no luck.

I have given the following API permissions under Microsoft Graph;

Calendars.Read Delegated
Calendars.Read Application
Calendars.Read.Shared Delegated
Directory.Read.All Delegated
Directory.Read.All Application
openid Delegated
profile Delegated
User.Read Delegated

What am I missing?

Thanks

Regards

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,080 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,126 questions
0 comments No comments
{count} votes

Accepted answer
  1. KalyanChanumolu-MSFT 8,316 Reputation points
    2021-04-24T07:28:51.48+00:00

    @-- -- Thank you for reaching out.

    Please give "MailboxSettings.Read" permissions and it should work.

    ----------

    If an answer is helpful, please "Accept answer" or "Up-Vote" for the same which might be beneficial to other community members reading this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful