DotNetCoreOauth2 icon indicating copy to clipboard operation
DotNetCoreOauth2 copied to clipboard

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

Open fpereiramapfrepr opened this issue 1 year ago • 3 comments

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!

fpereiramapfrepr avatar May 22 '24 12:05 fpereiramapfrepr

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..

yso8 avatar Jun 17 '24 13:06 yso8

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

fpereiramapfrepr avatar Jun 20 '24 20:06 fpereiramapfrepr

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!

yso8 avatar Jun 21 '24 14:06 yso8