Outlook SMTP server: authentication with oauth2 token (token NOT from windows live service but rather from login.microsoftonline.com).


I registered new web-application in "Microsoft Registration Portal". Wrote some server code in my service and managed to get access token for user with next scopes:

  • openid
  • offline_access
  • https://outlook.office.com/Mail.ReadWrite

Next step I tried to do was https://msdn.microsoft.com/en-us/library/dn440163.aspx (yes, I've read Important notice on top of the page, but it is kind of unclear related to my situation).

Made XOAUTH2 authenticate to SMTP server (smtp-mail.outlook.com):


send: 'AUTH XOAUTH2 dXNlcj1....9AQE=\r\n'
reply: '535 5.0.0 OAuth failed: OAuth authentication failed due to Invalid token.  Code -2147184118\r\n'
reply: retcode (535); Msg: 5.0.0 OAuth failed: OAuth authentication failed due to Invalid token.  Code -2147184118

Apparently my access token was invalid.

Question is next: should my access token with scopes above, acquired from https://login.microsoftonline.com, give me ability to authenticate in outlook SMTP server at all? Or this feature is already deprecated? ... If not, then how can I get proper access token? Is it possible to get such token for application registered through Microsoft Registration Portal?


August 13th, 2015 10:50am

Is there an Exchange 2013 server involved in this somehow?  If not, you've posted in the wrong forum.  If you're trying to connect to outlook.com, then I recommend you seek out an outlook.com forum.
Free Windows Admin Tool Kit Click here and download it now
August 13th, 2015 12:46pm

thanks for the hint
August 13th, 2015 2:14pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics