microsoftgraph/aspnet-snippets-sample

Authentication Error - Value cannot be null. (Parameter 'value')

andrewbaker-uk opened this issue · 3 comments

Describe the bug
Authentication Error - Value cannot be null. (Parameter 'value') seen on sign in after following steps in readme.md

image

To Reproduce
Steps to reproduce the behavior:

  1. Follow readme.md
  2. Navigate to https://localhost:5001
  3. Sign in with Azure AD account
  4. See error

Expected behavior

  1. Follow readme.md
  2. Navigate to https://localhost:5001
  3. Sign in with Azure AD account
  4. Access app as intended

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 10 19041.804
  • Browser: Edge
  • Version: 88.0.705.74

Dependency versions

  • Authentication library (MSAL, etc.) version: Version included with solution
  • Graph library (Graph SDK, REST library, etc.) version: Version included with solution

Thanks for reporting. This sample does need an update as the authentication libraries have been significantly re-worked since this was last touched. However it should still work.

Can you check something for me? Can you go to Graph Explorer, login with the same account you're using to reproduce this, and run a GET https://graph.microsoft.com/v1.0/me/mailboxsettings? If that works, do you see a value for timeZone? You may see it inside workingHours or automaticRepliesSetting, but specifically I'm looking to see if it's set at the top level (like the third line below).

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('xxx')/mailboxSettings(timeZone)",
    "archiveFolder": "AAMkAGVl...AAA=",
    "timeZone": "Eastern Standard Time",
    "delegateMeetingMessageDeliveryOptions": "sendToDelegateAndPrincipal",
    "dateFormat": "",
    "timeFormat": "",
    "automaticRepliesSetting": {
        "status": "disabled",
        "externalAudience": "none",
        "internalReplyMessage": "",
        "externalReplyMessage": "",
        "scheduledStartDateTime": {
            "dateTime": "2021-02-25T20:00:00.0000000",
            "timeZone": "UTC"
        },
        "scheduledEndDateTime": {
            "dateTime": "2021-02-26T20:00:00.0000000",
            "timeZone": "UTC"
        }
    },
    "language": {
        "locale": "en-US",
        "displayName": "English (United States)"
    },
    "workingHours": {
        "daysOfWeek": [
            "monday",
            "tuesday",
            "wednesday",
            "thursday",
            "friday"
        ],
        "startTime": "09:00:00.0000000",
        "endTime": "17:00:00.0000000",
        "timeZone": {
            "name": "Eastern Standard Time"
        }
    }
}

Ahh this is slightly embarrassing. I'm using a Office 365 Developer account and I hadn't yet accessed the mailbox.

I didn't have an value for timeZone on the top level like in the example. As soon as I went to the mailbox and tried again, the value was populated :)

Thanks for the help

Thanks for confirming! I suspected this was the case as someone else had a similar issue with the tutorial that this is based off of. The fix hasn't come over to this repo yet :D.