Rails 7 #122 sign in with Microsoft Azure OAuth and Single Sign-On

07/04/2023 (about 1 year ago)
omniauth oauth2 microsoft login devise oauth microsoft azure

Let’s add a “Sign in with Microsoft” button!

Most big corporations use Microsoft to manage their employees email addresses. If you are building a B2B app, you will definitely need to add Microsoft single-sign-on.

Microsoft Azure has a few oAuth authentication services, and it can be tricky finding the right API service and the right ruby gem to use.

Good news: I've done the research, so that you don't need to!

Based on this blogpost: https://blog.corsego.com/microsoft-azure-omniauth
Episode source code: https://github.com/corsego/122-omniauth-microsoft/commit/748452eea6b01f0cb48321e39477d88ab4571381

0:00 different microsoft omniauth gems
0:46 install azure activedirectory gem
1:52 Register app on Azure, get Microsoft API client ID
04:48 generate Microsoft API Secret Key
5:30 try to authenticate with a Microsoft account
6:50 make omniauth work with our Rails app
10:27 Demo: sign in with Microsoft oAuth
11:11 Track provider and UID
13:20 Launching in Production


0
Sign in to join the conversation