- Products
- Solutions Use casesBy industry
- Developers
- Resources Connect
- Pricing
The blog post has been updated to work with Nylas API V3.
In this post, let’s take a look at creating an Azure App to use with Nylas. This is useful when building applications requiring access to a user’s communication data. In this scenario, we’ll be allowing Outlook users to connect their accounts so we can access their email, calendar, and contacts. We created a similar post on how to create a Google API project. This post will walk the reader through how to create an Azure App.
Also, check out our livestream that walks you through setting up your first Azure app:
quickstart apps
) does not allow setting up Outlook AuthenticationNo local environment setup is required, we’ll be using the Nylas and Azure dashboards to set everything up.
A few items we need to consider upfront are authentication flow and supported account types.
The two different authentication flows are: hosted and native authentication. Hosted authentication flow is a no-code approach to connecting users. The differences between hosted and native authentication are discussed in the Nylas docs. We’ll be using hosted authentication.
Most applications will be external public-facing applications. This requires additional checks before publishing and you are initially limited on the total number of test accounts. For the purposes of this blog, when creating an app in Azure, when selecting Supported account types
, we will use Accounts in any organizational directory
that is open to all users.
Let’s jump into Azure and create our app. This involves a few steps, so we’ll go through them one by one.
The Nylas docs contain a list of different Azure permissions we can set up when building with Nylas. Keep in mind that we have a few Azure scopes that will be required (openid
, profile
, and User.Read
) when creating an Azure app. For now, let’s consider the flow where we are just accessing the user’s calendar data, so that will requires us to include the Calendars.Read
Azure API permission.
Let’s head over to Azure and create a new app:
One thing to note is that since we are using Nylas’ Hosted Authentication, we need to add the Redirect URI as https://api.nylas.com/oauth/callback
as per the Nylas docs on Integrated Hosted Authentication.
Now we’ve created an Azure App that we can start to configure the APIs we want to use.
The APIs that we enable will allow us to access specific user communication data: profile data, contacts, emails, calendars, and available resources (i.e. room availability). For now lets’ consider connecting the Azure Calendar API so that we can receive emails.
We’ve gone ahead and added the required permissions (openid
, profile
, and User.Read
), so let’s add the Calendar scope (Calendar.Read
):
One thing to keep in mind is that we are setting up Application permission for Calendar.Read. Have a look at Azure’s overview of permissions and consent.
Now we’ve enabled the Azure permissions to receive a user’s calendar data such as upcoming events.
We need to create API credentials, so Nylas can communicate with Azure API and similar service providers to retrieve the user data for us. The purpose of doing this is so our application can receive a consistent structure of communication data across all providers as we build out our application.
Let’s set up the Azure API OAuth Credentials on Azure:
After creating the new secret, you will have a Value and Secret ID:
Note: Ensure to securely store the Secret ID, this should not be publicly available (i.e. the client credentials have been deleted)
We will be taking the Secret ID and adding it to the Nylas Dashboard shortly. Another value that we will need is the Application (client) ID for the app we created (azure-app):
Now we’ve set up OAuth credentials so we can start communicating with the Azure API to access user communication data like upcoming calendar events.
Let’s add the Azure OAuth credentials to the Nylas dashboard:
Note in the above image, we created a new application azure-app
before adding the Azure OAuth credentials user to the Office365 Auth
section of Authentication
.
Let’s test out the integration by connecting an Outlook account using the Nylas Dashboard (this is equivalent to using Nylas’ Hosted Authentication):
Note: Ensure to securely store the access token, this should not be publicly available (i.e. the client credentials have been deleted)
Now we’ve successfully tested connecting to an Outlook account using the Nylas Dashboard.
Continue building with Nylas and learn more by visiting the documentation. Sign up here if you need to create a Nylas account for free!
Ram loves teaching, building and exploring technologies. He is passionate about empowering developers to ship amazing products to market as fast as possible ????. Ram is excited to share knowledge and help others. He’s a Relaxed Tomato ????.