Microsoft Social Login with Magic
Microsoft Social Login with Magic
#Overview
You can allow your users to sign up & log in to your web app with their Microsoft account.
#Usage
#Prerequisites
- You will need a Microsoft Azure account
- You will need to have the Magic SDK installed into your web app
- You will need to have the Magic SDK - OAuth Extension installed into your web app
#Microsoft Setup (v1 extension)
After installing the OAuth extension, you can now enable Microsoft Login for your Magic app:
- Go to your Magic Dashboard
- Select the Magic app for which you’d like to enable Microsoft Login, or create a new app
- Navigate to Social Login from the sidebar
- Click the toggle for Microsoft
- Copy the Redirect URI field from your Magic Dashboard
- Follow Microsoft's registration instructions to register your app
- Search and navigate to App registrations section
- Click New registration
- Make sure to select personal Microsoft accounts to allow your users to access your oauth app. Paste redirect link from Magic Dashboard into the Redirect URI.
- After register your app, select Certificates & secrets in the sidebar, click New client secret, and obtain the client secret Value
- Navigate back to Overview in the sidebar, obtain the Client ID
- Return to your Magic Dashboard and input the Client ID and Client Secret for your Microsoft OAuth app and click “Save”
- Click "Test Connection" to give your new Microsoft OAuth flow a try!
#Microsoft Setup (v2 extension)
- Follow above steps, but disregard Magic's Redirect URI in step 5
- In step 9, paste the Redirect URI you are passing in as the redirectURI argument to the loginWithRedirect method
Javascript
01await magic.oauth2.loginWithRedirect({
02 provider: 'microsoft',
03 redirectURI: 'https://your-app.com/your/oauth/callback', // <== whitelist this with Microsoft
04});