question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] MSAL OAuth2 + EWS not working

See original GitHub issue

Which Version of MSAL are you using ? 4.1.0

Platform Net 4.7

What authentication flow has the issue?

  • Desktop / Mobile
    • [ x ] Interactive

Other? - please describe;

Is this a new or existing app? New App

Repro Follow: https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-authenticate-an-ews-application-by-using-oauth

Use an outlook.com account to login after setting the audience in above tutorial to support personal and work accounts.

Code sample is included in above tutorial

Expected behavior You see the folders in your mailbox

Actual behavior

Error: System.ArgumentException: The given token is invalid.
   at Microsoft.Exchange.WebServices.Data.OAuthCredentials..ctor(String token, Boolean verbatim)
   at Microsoft.Exchange.WebServices.Data.OAuthCredentials..ctor(String token)
   at EwsOAuth.Program.<MainAsync>d__1.MoveNext() in C:\Users\dev\source\repos\EWS\EWS\Program.cs:line 43

Possible Solution

Additional context/ Logs / Screenshots It’s really easy to reproduce.

Try logging-in using an outlook.com account.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dsanghancommented, Jul 17, 2019

To be clear, the token works if I sign in with an Office365 account, but does not work if I sign in with an Outlook account.

0reactions
jmprieurcommented, Sep 23, 2019

@guidedways : I’ve contacted people on the Office side. again this is not MSAL, but how the token is being used by ews-managed-api.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authenticate an EWS application by using OAuth
Learn how to use OAuth authentication with your EWS Managed API applications. ... These examples do not include error checking, see the Code ......
Read more >
ews streaming connection reconnect with oAuth2
seems to work fine now, service has been running all night no issues. Public Async Sub Reconnect(ByVal sender As Object, ...
Read more >
Remedy - AR System Server Email Engine - Failing to connect ...
After configuring the Email Engine to use EWS with OAuth2, it is not sending or receiving email. Logging shows "Confidential Client is not...
Read more >
Issues changing to Microsoft graph for authenticated login.
Due to Microsoft's deprecation of basic authentication we are changing from EWS to Microsoft Graph. We were given instructions for how to ...
Read more >
How to Resolve the Need Admin Approval Error
The “Need Admin Approval” error may occur when a regular user attempts to get authenticated in Revenue Grid with one's Office 365 credentials...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found