23

I'm working with the EWS Java API 1.2 in an Android application. Logging in with username/password WebCredentials is working fine using something like this:

ExchangeService service = new ExchangeService();
ExchangeCredentials credentials = new WebCredentials("domain\\username", "password");
service.setCredentials(credentials);

Instead of supplying the password every time, I'd like to supply an authentication token. The EWS API contains a TokenCredentials class, but how do I use it? Given a username and password, how do I generate a reusable authentication token? Once I generate such a token, how long is it valid?

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
quietmint
  • 13,885
  • 6
  • 48
  • 73

1 Answers1

1

You can now use OAuth tokens: http://msdn.microsoft.com/en-us/library/office/dn626019(v=exchg.150).aspx. This topic was just updated a few weeks ago with some basic info.

Mimi Gentz
  • 1,628
  • 10
  • 14
  • While potentially helpful info, this isn't really an answer to this question. It appears Exchange servers don't support OAuth by default and require a third-party authentication provider. Further, the basic question of how to provide a token to the EWS Java API remains. – quietmint Mar 13 '14 at 16:14
  • Mimi, thank you for your willingness to help. It is better to use include essential parts of the link in your answer because links may and do become broken over time, unfortunately. – László Papp Mar 15 '14 at 11:33
  • Thanks for the tip Laszlo, I'll be sure to do that in the future. I was thinking more about this thread. I know about EWS & EWS Managed API, but not much about the Java API. Does the Java API enable you to add headers to your request? If so, then I think you could get OAuth to work with the EWS Java API - or that's my hypothesis anyways. – Mimi Gentz Mar 19 '14 at 23:00
  • 1
    Unfortunately, it is very very very basic info :( – MichelZ Apr 06 '14 at 09:57