Authenticate Microsoft accounts with Nylas
After you create an Azure application, your next step is deciding how to authenticate your end users to Nylas.
🔍 Nylas Hosted Auth follows the OAuth 2.0 flow, and Nylas takes care of the underlying authentication process. To set up your auth flow, you must first configure Hosted Auth using either an API key or an access token.
Before you begin
Before you choose an authentication method, Nylas recommends you read the following documentation:
- Hosted Authentication with an API key
- Hosted Authentication with an access token
- Custom Authentication
You also need to complete the following prerequisites for your production application:
Authenticate Exchange accounts
⚠️ Microsoft announced the retirement of Exchange Web Services in 2022 and strongly recommended that all users migrate to use Microsoft Graph. Users on Exchange Online have already been migrated.
Nylas v3 includes an EWS connector that you can use to authenticate accounts hosted on Exchange on-premises servers. Other types of Exchange accounts must upgrade to use Microsoft Graph scopes, then authenticate using the Microsoft connector.
For more information, see Authenticate Exchange on-prem servers with Nylas.
Set up Custom Authentication
Microsoft supports modern authentication/OAuth only. The flow follows these basic steps:
-
Your Nylas application completes the OAuth process with Microsoft and receives a
refresh_token
for the end user's account. -
Your application makes a Custom Authentication request to Nylas using the end user's
refresh_token
.curl --request POST
--url https://api.us.nylas.com/v3/connect/custom \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <NYLAS_API_KEY>'\
--header 'Content-Type: application/json' \
--data '{
"provider": "microsoft",
"settings": {
"refresh_token":"<REFRESH_TOKEN>"
},
"state": "<STATE>"
}' -
Nylas creates a grant for the end user and returns its details.