New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to Authenticate an EWS application by using OAuth? #748
Comments
`public final class BearerTokenCredentials extends ExchangeCredentials {
}` ` String email = "emailaddressxx";
|
Can you show us MsEwsTokenProvider.java? By the way use triple back ticks for blocks of code (not single back ticks). |
`public final class MsEwsTokenProvider {
I can got the token,but can not get the mail inbox. Thanks |
Yeah but if you are getting a 401 it means that the token doesn't authenticate you. I guess it could be a permission problem and the service is giving you a 401 instead of the appropriate 403. |
Triple ticks please, formatting gets stuffed up. |
Any idea how to resolve it tho? On the EWS docs, theres two types of Authentication, Delegated and App only |
@Chandler54321 I notice that our code (that works fine) does this step: service.setImpersonatedUserId(new ImpersonatedUserId(ConnectingIdType.PrincipalName, email)); You might want to try that instead of your line: service.setImpersonatedUserId(new ImpersonatedUserId(ConnectingIdType.SmtpAddress, email)); |
BearerTokenCredentials credentials = new BearerTokenCredentials(MsEwsTokenProvider.getAccesToken()); service.setCredentials(credentials); |
You answer is quite helpful to me, Thanks a lot. |
Did your BearerTokenCredentials class extend ExchangeCredentials? |
https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-authenticate-an-ews-application-by-using-oauth
How to Authenticate an EWS application by using OAuth in Java?
Thanks
The text was updated successfully, but these errors were encountered: