-
Notifications
You must be signed in to change notification settings - Fork 560
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: