Azure Static Web Apps: pass dynamic parameters to ./auth/login?

Tony Lunt 0 Reputation points
2025-06-24T16:13:07.15+00:00

I use a custom OpenID Connect authentication provider in an Azure Static Web App. My authentication provider supports a "login_hint" URL parameter to populate the user's email address or username. However, I can't figure how to get the SWA to pass this through.

Any ideas? It's a pretty major experience gap that we can't give users an easy login button from an email, so I'm hoping that there is an easy way to accomplish this.

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
{count} votes

3 answers

Sort by: Most helpful
  1. Shree Hima Bindu Maganti 6,200 Reputation points Microsoft External Staff Moderator
    2025-06-25T16:10:11.78+00:00

    Hi @Tony Lunt
    Apology for your inconveniences.
    When using Azure Static Web Apps, dynamic parameters like login_hint are expected to be passed to the authentication provider via the URL during authentication. If the login_hint parameter is not making it through the redirects, this may be related to how Azure Static Web Apps manages the authentication process.

    If your configuration does not specifically support preserving login_hint, the initial redirect to the login endpoint might drop this parameter. It's important to verify that your authentication provider is set up to accept and process login_hint. If adding login_hint manually to the final URL works, it suggests that Azure Static Web Apps is not retaining it throughout the authentication steps.

    To resolve this, check that your authentication provider allows login_hint, review your Azure Static Web Apps authentication settings for anything affecting parameter forwarding, and consult Azure documentation or support for further guidance on this issue.
    References:

    0 comments No comments

  2. Tony Lunt 0 Reputation points
    2025-06-25T16:26:40.3833333+00:00

    @Shree Hima Bindu Maganti thank you again for all of your responses here. Based off everything you shared and the fact that my authentication provider supports login_hint, it appears that the Static Web App is dropping this parameter before the request forwards on to the authentication provider. I will open a support case with Azure.

    0 comments No comments

  3. AndrewElans 0 Reputation points
    2025-12-12T10:10:49.3466667+00:00

    UPDATE

    I've tested with multiple users and looks like this approach does not work

    ----------------------------------------------

    For those struggling with passing a login_hint to Azure Static Web App (SWA):

    If swa is provisioned with the free hosting plan, you can neither customize aad flow nor enable login_hint due to a lack of azure app registration linked to the SWA.

    When swa is created, a generic enterprise application is created with name Azure Static Web Apps for this and all other swas which handle built-in aad authentication.

    To use login_hint, upgrade to standard hosting plan is required. After this a new app registration shall be created with:

    1. a new client secret name and value and passed in the auth key of staticwebapp.config.json as explained here dori-uw-1.kuma-moon.com/en-us/azure/static-web-apps/authentication-custom.
    2. In Token configuration -> Add optional claim login_hint

    Now you can silently authenticate your user as this: https://app-url.com/.auth/login/aad?login_hint=******@site.com

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.