Skip to content

Test Failure in ConsoleAppTest Using MailKit: AADSTS70011 Error with Invalid Scope #3

Open

Description

@fpereiramapfrepr

The test in the ConsolaAppTest is failing due to an error related to the ‘scope’ input parameter when using the MailKit library. The specific error message is:

Microsoft.Identity.Client.MsalServiceException: 'AADSTS70011: The provided request must include a 'scope' input parameter. The provided value for the input parameter 'scope' is not valid. The scope email https://outlook.office.com/IMAP.AccessAsUser.All is not valid.
Trace ID: XXXXX
Correlation ID: XXXXX'

The exact line that throws the error is "confidentialClientApplication.AcquireTokenForClient."

Prior to the test, all necessary setup was performed in Azure as shown in the YouTube video for the App Registration.

Thanks for your help and your videos are awesome!

Activity

  1. yso8 commented on Jun 17, 2024

    @yso8

    hey, did you manage to solve your problem? I currently have the same problem on my program, which has significantly the same code.
    When I run this solution I also get the error even if I set the scopes to 'https://graph.microsoft.com/IMAP.AccessAsUser.All'. I can't make any progress..

  2. fpereiramapfrepr commented on Jun 20, 2024

    @fpereiramapfrepr
    Author

    Hi. Needed to make some changes at the Azure App Registration Level. Only manage to make work DotNetCoreOAuth2 the same way that he does in the video. https://www.youtube.com/watch?v=bMYA-146dmM

  3. yso8 commented on Jun 21, 2024

    @yso8

    Perfect, indeed, this video helped me execute the commands as other tutorials/documentation had misled me. I had resorted to using Gmail due to its simplicity, but now everything works. Thank you very much for your quick response!

  4. webbrain-one commented on Aug 6, 2026

    @webbrain-one

    Hi there! Thanks so much for the kind words about the videos 🙌 I've opened a pull request to address this: #5

    The fix updates the scope configuration to properly align with the client credentials flow, which resolves the AADSTS70011 invalid scope error when calling AcquireTokenForClient. Give it a try when you get a chance and let me know if everything runs smoothly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions