When trying to log into Microsoft, it returns "Invalid request. Request is malformed or invalid." (AADSTS9002313)

This error message usually occurs when the request is not properly formatted or Office365 can't perform this authentication. It could be due to a number of reasons such as incorrect credentials, incorrect URL or parameters, or an expired token.

Couldn't exchange OAuth code for a Microsoft refresh token. Provider error: invalid_grant, error description: AADSTS9002313: Invalid request. Request is malformed or invalid. Trace ID: <TRACE_ID> Correlation ID: <CORRELATION_ID> Timestamp: <TIMESTAMP>, error status code: 400


Endpoint / Log: 

  • Returns during authentication flow, Auth Logs, and application API logs found on the Nylas Dashboard



  • Some information in the authentication proposal was incorrect.
  • This mailbox doesn't support this authentication method.
  • The user is authenticating with their mailbox's UserPrincipleName instead of their Mail value.


  • If this mailbox is a Microsoft Free or Family account, they need to use the Outlook provider instead.
  • If this mailbox is a Microsoft Business or School account and they don't have a paid license, they will get this error and are unable to use Nylas until they pay for a Microsoft Office365 license.
  • Check your credentials and ensure that they are correct.
  • If the user MUST authenticate with their UserPrincipleName and can't use their Mail value, see https://nylas.zendesk.com/knowledge/articles/10115770114717/en-us?brand_id=446347
  • Check the URL and parameters you are using.
  • Ensure that your token has not expired.
  • Try clearing your browser cache and cookies.
  • Try using a private session or incognito window.
  • Ensure to start the authentication flow from the beginning each time as each proposal is unique. If you bookmark the login page, make sure it doesn't contain any proposal ids.
  • Try using a different browser.





Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request



Please sign in to leave a comment.