We've updated our Terms of Service. By continuing to use our services, you agree to the updated Terms.

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

note

Magic SDK offers two OAuth extensions: v1 and v2. For web applications, it is recommended to use v2, while v1 should be used for mobile applications.

#Microsoft Setup (v1 extension)

After installing the OAuth extension, you can now enable Microsoft Login for your Magic app:

  1. Go to your Magic Dashboard
  2. Select the Magic app for which you’d like to enable Microsoft Login, or create a new app
  3. Navigate to Social Login from the sidebar
  4. Click the toggle for Microsoft
  5. Copy the Redirect URI field from your Magic Dashboard
  6. Follow Microsoft's registration instructions to register your app
  7. Search and navigate to App registrations section
  8. Click New registration
  9. 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.
  10. After register your app, select Certificates & secrets in the sidebar, click New client secret, and obtain the client secret Value
  11. Navigate back to Overview in the sidebar, obtain the Client ID
  12. Return to your Magic Dashboard and input the Client ID and Client Secret for your Microsoft OAuth app and click “Save”
  13. 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});

#Resources