Usage

Prerequisites

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
app-registration.png
  1. Click New registration
new-registration.png
  1. 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.
  2. After register your app, select Certificates & secrets in the sidebar, click New client secret, and obtain the client secret Value
create-secret.png
  1. Navigate back to Overview in the sidebar, obtain the Client ID
client-id.png
  1. Return to your Magic Dashboard and input the Client ID and Client Secret for your Microsoft OAuth app and click “Save”
  2. 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
await magic.oauth2.loginWithRedirect({
  provider: 'microsoft',
  redirectURI: 'https://your-app.com/your/oauth/callback', // <== whitelist this with Microsoft
});

Resources