Skip to content

Custom OpenIdConnectProviders is broken in 1.1.8 #844

@SirMrDexter

Description

@SirMrDexter

Before filing this issue, please ensure you're using the latest CLI by running swa --version and comparing to the latest version on npm.

Are you accessing the CLI from the default port :4280 ?

  • No, I am using a different port number (--port) and accessing the CLI from that port
  • Yes, I am accessing the CLI from port :4280

Make sure you are accessing the URL printed in the console when running swa start!

ℹ️ NOTE: Make sure to enable debug logs when running any swa commands using --verbose=silly

Describe the bug
When using custom identify providers with OpenID Connect, we should be able to login using the URL
/.auth/login/
Refer to docs: https://learn.microsoft.com/en-us/azure/static-web-apps/authentication-custom?tabs=openid-connect%2Cinvitations#configure-a-custom-identity-provider
But since 1.1.8, when you login using that URL you get a 404 response.
Instead when you change the login URL to /.auth/login/customOpenIdConnectProviders, then it works. This is contrary to how the URL works in the cloud.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new swa project from scratch
  2. Add staticwebapp.config.json file with below content in it.
{
  "auth": {
    "rolesSource": "/api/my/roles",
    "identityProviders": {
      "customOpenIdConnectProviders": {
        "aadb2c": {
          "registration": {
            "clientIdSettingName": "AADB2C_PROVIDER_CLIENT_ID",
            "clientCredential": {
              "clientSecretSettingName": "AADB2C_PROVIDER_CLIENT_SECRET"
            },
            "openIdConnectConfiguration": {
              "wellKnownOpenIdConfiguration": "https://AADB2C_PROVIDER_ISSUER_URL/.well-known/openid-configuration"
            }
          },
          "login": {
            "nameClaimType": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
            "scopes": [ "openid", "profile" ],
            "loginParameterNames": []
          }
        }
      }
    }
  }
}
  1. start the app using swa start
  2. Go to http://localhost:4280/.auth/login/aadb2c

Expected behavior
Should get the emulator login screen with the provider name as aadb2c

Screenshots
image
image

Desktop (please complete the following information):

  • OS: Windows
  • Version 10
  • Node Version 18
  • SWA Cli version: 1.1.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    command: startAll issues related to the start commandpriority: medium (P1)Medium priorityruntime: staticIssues related a static app (not API)scope: authIssues related to the authentication emulatortype: bugSomething isn't workingversion: gaIssues related to major/GA releases

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions