/
Contact usSee pricingStart building
    Introduction
    Overview
    Postman
    Users
      Create user
      Search users
      Get user
      Update user
      Exchange primary factor
    • Delete

      • Delete user
        Delete user email
        Delete user phone number
        Delete user WebAuthn registration
        Delete user biometric registration
        Delete user TOTP
        Delete user crypto wallet
        Delete user password
        Delete user OAuth registration
    Magic links
    • Via email

      • Send magic link
        Log in or create user
        Invite
        Revoke pending invite
    • Embeddable

      • Create
      Authenticate
    OAuth
      Attach
      Authenticate
    • Start

      • Google
        Amazon
        Apple
        Bitbucket
        Coinbase
        Discord
        Facebook
        Figma
        GitHub
        GitLab
        Linkedin
        Microsoft
        Salesforce
        Slack
        Snapchat
        TikTok
        Twitch
        Twitter
        Yahoo
    Passwords
      Create
      Authenticate
      Strength check
      Migrate
    • Reset options

      • Password reset by email start
        Password reset by email
        Password reset by existing password
        Password reset by session
    One-time passcodes (OTP)
    • Via SMS

      • Send
        Login or create user
    • Via Whatsapp

      • Send
        Login or create user
    • Via email

      • Send
        Login or create user
      Authenticate
    Session management
      Session object
      Get JWKS
      Get sessions
      Authenticate Session
      Revoke session
      Migrate session
    Passkeys & WebAuthn
    • Register

      • Start
        Register
    • Authenticate

      • Start
        Authenticate
      Update
      List WebAuthn Credentials
    Time-based one-time passcodes (TOTP)
      Create
      Authenticate
      Get recovery codes
      Recover
    Crypto wallets
      Authenticate start
      Authenticate
    M2M Authentication
      M2M Client Object
    • Token

      • Get Access Token
        Authenticate Access Token
    • M2M Client

      • Create M2M client
        Get M2M client
        Search M2M clients
        Update M2M client
        Delete M2M client
    • Rotate secret

      • Start secret rotation
        Rotate secret
        Cancel secret rotation
    Connected AppsBeta
      Get Access Token
    • Tokens

      • Connected App ID Token Object
        Connected App Access Token Object
    • Configuration

      • Get JWKS
        Get OpenID Configuration
    • Methods

      • Introspect Token
        Authenticate Access Token (Local)
        Exchange Access Token
        Revoke Token
        Get UserInfo
    User Impersonation
      Authenticate Token
    Resources
      Email templates
      URL validation
      Metadata
      User states
    Errors
      Overview
      Error object
      400
      401
      403
      404
      405
      429
      499
      500
      503
Get support on SlackVisit our developer forum

Contact us

Consumer Authentication

/

API reference

/

OAuth

/

Start

/

Microsoft

Start Microsoft OAuth flow

GET
https://test.stytch.com/v1/public/oauth/microsoft/start

A client-side endpoint (can only be queried from the user's browser) that starts the Microsoft OAuth flow. This endpoint generates the Microsoft OAuth URL with all of the required fields and redirects a user to that URL. From there, the user signs into their Microsoft Account before getting redirected back to Stytch. After verifying the request, Stytch immediately redirects the user back to the login_redirect_url or signup_redirect_url URLs provided.

We do not return email addresses for Microsoft OAuth users. For more information, see our Email address behavior guide.

Scopes

By default our Microsoft OAuth integration includes open_id, email, and profile scopes. You may add any additional Microsoft API scopes (see here for a complete list) as a space separated list in the custom_scopes query parameter of /oauth/microsoft/start.

To receive a refresh_token, request the offline_access custom scope.

Additional provider parameters

Any parameters that should be forwarded to the OAuth provider can be passed as query parameters with the provider_ prefix. For example, some OAuth providers support a login_hint parameter that allows you to pre-populate the OAuth login flow with a suggested email address. To specify the login_hint parameter in your OAuth request, you'd include provider_login_hint=exampleHint as a query parameter. We recommend consulting each OAuth provider's documentation for a list of supported parameters.

Next steps

Once the user successfully authenticates with Microsoft, they'll be redirected to the redirect URL that you provided at the start of the OAuth flow with a Stytch OAuth token. Collect the token from the URL query parameters, and call Authenticate OAuth token to complete authentication.


Query parameters


public_token* string

login_redirect_url string

signup_redirect_url string

custom_scopes string

provider_[parameter] string

code_challenge string

oauth_attach_token string

Response fields


status_code int

request_id string

redirect_url RedirectURL
// Not applicable since this endpoint is only meant to be queried on the client's browser
RESPONSE
302
​
{
    "status_code": 302,
    "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
    "redirect_url": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize?access_type=offline&client_id=example-client-id&redirect_uri=https%3A%2F%2Fstytch.com%2Fv1%2Foauth%2Foauth-callback-test-d868b16b-3ecd-49ac-7fc6-e3d1051c5d65&response_type=code&scope=openid+email+profile&state=example-state",
}