8-Week Microsoft Teams AppDev Accelerator Program
Limited seats available! - Start date: Wednesday, April 16, 2025
Join Today & Save $1,000
articles

Get OAuth2 Access Tokens Microsoft 365 with Entra ID

I discuss the importance of having a OAuth2 access token for Microsoft 365 and explain how to obtain it using Microsoft Entra ID.

Get OAuth2 Access Tokens Microsoft 365 with Entra ID
by Andrew Connell

Last updated December 16, 2014
2 minutes read

Share this

Focus Mode

  • Feedback & questions

Before you even get started coding against the Office 365 APIs, you need to get an OAuth2 access token that is trusted by Office 365. Microsoft has set up Microsoft Entra ID as the trust and token issuer for Office 365 which is a great solution because you can use it to store your users or you can configure it to federate logins with your on-premises Active Directory or third party authentication system.

In order to obtain the access token you have to create an application in Microsoft Entra ID that has been given the necessary permissions to access resources in Office 365 like reading your calendar or writing to your contacts. Once you do that, when a user successfully authenticates against Microsoft Entra ID, before retrieving an access token, if they haven’t already done so Microsoft Entra ID will prompt them to grant consent to the application to do the things that the developer configured in the app such as reading your calendar and singing you in:

Microsoft Entra ID Authentication

Microsoft Entra ID Authentication

So how do you create this Microsoft Entra ID app? There are two ways at the present time. You can use the Add Connected Service dialog in Visual Studio 2013 to do this or you can create it manually form the Azure Management Portal.

So let’s get started. You can read through the next two posts in order, or just jump to the one that interests you:

Andrew Connell, Microsoft MVP, Full-Stack Developer & Chief Course Artisan - Voitanos LLC.
author
Andrew Connell

Microsoft MVP, Full-Stack Developer & Chief Course Artisan - Voitanos LLC.

Andrew Connell is a full stack developer who focuses on Microsoft Azure & Microsoft 365. He’s a 20+ year recipient of Microsoft’s MVP award and has helped thousands of developers through the various courses he’s authored & taught. Whether it’s an introduction to the entire ecosystem, or a deep dive into a specific software, his resources, tools, and support help web developers become experts in the Microsoft 365 ecosystem, so they can become irreplaceable in their organization.

Feedback & Questions

newsletter

Join 10,000+ developers for news & insights

No clickbait · 100% free · Unsubscribe anytime.

Subscribe to Andrew's newsletter for insights & stay on top of the latest news in the Microsoft 365 Space!
blurry dot in brand primary color
found this article helpful?

You'll love these!

Create Azure App for Office 365 APIs: Part 2 (Visual Studio)

Create Azure App for Office 365 APIs: Part 2 (Visual Studio)

December 16, 2014

Read now

Create Entra ID apps for Office 365 APIs - Manual Creation

Create Entra ID apps for Office 365 APIs - Manual Creation

December 16, 2014

Read now

Office 365 API Auth with Microsoft Entra ID - What I Learned

Office 365 API Auth with Microsoft Entra ID - What I Learned

December 15, 2014

Read now

bi-weekly newsletter

Join 10,000+ Microsoft 365 full-stack web developers for news, insights & resources. 100% free.

Subscribe to Andrew's newsletter for insights & stay on top of the latest news in the Microsoft 365 ecosystem!

No clickbait · 100% free · Unsubscribe anytime.

Subscribe to Andrew's newsletter for insights & stay on top of the latest news in the Microsoft 365 Space!