0 votes
by (240 points)


I'm trying to access folder contents of a specific user in my azure tenant.
After entering the E-mail and password I get an error.

await client.LoginAsync("mock@test.com", "******", EwsAuthentication.OAuth20);

The Error:

Error: Rebex.Net.EwsException: OAuth token submitted with the request can not be parsed (invalid_token).

any ideas?

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (67.2k points)

You specified EwsAuthentication.OAuth20 authentication method but you are using your password instead an OAuth token.

To use OAuth20 authentication you have to:

  1. Register your application in the Microsoft Azure (see this blogpost).
  2. Use an OAuth Identity client to retrieve an OAuth token, which can be passed to the Rebex.Net.Ews.LoginAsync() method (see this blogpost).

To test your setup, you can try our simple app publish on Github.