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

- URL: https://superails.com/posts/rails-7-122-sign-in-with-microsoft-azure-oauth-and-single-sign-on
- Published: 2023-04-07
- Duration: 14:08
- Access: free
- Topics: omniauth, oauth2

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

## Chapters

- 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
