Skip to content

Error message when reaching .../.auth/login/google?... : ClientId not found for 'google' provider #840

Description

@ThierryLangie

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
A clear and concise description of what the bug is.

1st try:
Reaching http://localhost:4280/.auth/login/google?post_login_redirect_uri=/useredit gives the error message on the page 'ClientId not found for 'google' provider'

staticwebapp.config.json:

"auth": {
"rolesSource": "/api/roles",
"identityProviders": {
"google": {
"registration": {
"clientIdSettingName": "GOOGLE_CLIENT_ID",
"clientSecretSettingName": "GOOGLE_CLIENT_SECRET"
}
}
}
}

2nd try:

If I remove this "google" config from my staticwebapp.config.json it works again (as expected)

3rd try:

Just for testing: reaching http://localhost:4280/.auth/login/gooooooogle?post_login_redirect_uri=/useredit works. I mean I'm not getting the error message ClientId not found for 'google' provider anymore and I'm reaching the Azure Static Web App Emulator as expected.

Tried to clear the cache of the browser + the Local storage + tried with another browser as well. Without luck.

To Reproduce
Steps to reproduce the behavior:

  1. Type in command 'swa start http://localhost:5152/ --api-location http://localhost:7238/'
  2. Start without debugging
  3. In Google Chrome, browse to 'http://localhost:4280/'
  4. Then click on 'Sign in with Google' button which target 'http://localhost:4280/.auth/login/google?post_login_redirect_uri=/useredit'
  5. See error 'ClientId not found for 'google' provider'

Expected behavior
What is expected: after clicking on my 'Sign in with Google' button which target 'http://localhost:4280/.auth/login/google?post_login_redirect_uri=/useredit' I should be redirected to the Azure Static Web App Emulator - Authentication Portal page for the 'Google' provider where I can adjust some params like User ID, Username, User's roles and User's claims.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS] Windows
  • Version [e.g. 22] 11
  • Node version: v20.12.2
  • SWA version: 1.1.8

Additional context

It was working perfectly fine (for weeks) until today. AFAIK I didn't changed/updated anything on my machine. Same problem occurs with another projet. But no problem when deployed on AZURE. This problem is only occurring locally with the Azure SWA Emulator.

Below an extract of SWA found in my console:
Welcome to Azure Static Web Apps CLI (1.1.8)

Getting config file options from "swa-cli.config.json"...
Changed directory to C:\Users\t_lan\Documents\WORK\AZUR\PrologV5


  • WARNING: This emulator may not match the cloud environment exactly. *
  • Always deploy and test your app in Azure. *

Checking if localhost:4280 is accepting TCP connections...
Port 4280 is available. Use it.
Resolved port number: 4280
appDevserverUrl provided, we will try connect to dev server at .
[swa] Skipping Api because folder "C:\Users\t_lan\Documents\WORK\AZUR\PrologV5\http:\localhost:7238" is missing
Trying to read workflow config with values:

  • appLocation: C:\Users\t_lan\Documents\WORK\AZUR\PrologV5
  • outputLocation: http://localhost:5152
  • apiLocation: http://localhost:7238
    Detected dev server configuration
    User workflow config:
  • appLocation: C:\Users\t_lan\Documents\WORK\AZUR\PrologV5
  • outputLocation: http://localhost:5152
  • apiLocation: http://localhost:7238
    Running echo 'No Data API found'. Skipping
    Starting the SWA emulator with the following configuration:
  • ssl:
    • 0: false
    • 1:
    • 2:
  • env:
    • SWA_RUNTIME_CONFIG_LOCATION: C:\Users\t_lan\Documents\WORK\AZUR\PrologV5
    • SWA_RUNTIME_WORKFLOW_LOCATION:
    • SWA_CLI_DEBUG: silly
    • SWA_CLI_API_PORT: 7071
    • SWA_CLI_APP_LOCATION: C:\Users\t_lan\Documents\WORK\AZUR\PrologV5
    • SWA_CLI_OUTPUT_LOCATION: http://localhost:5152
    • SWA_CLI_API_LOCATION: http://localhost:7238
    • SWA_CLI_DATA_API_LOCATION:
    • SWA_CLI_DATA_API_PORT: undefined
    • SWA_CLI_HOST: localhost
    • SWA_CLI_PORT: 4280
      • SWA_CLI_APP_SSL: false
    • SWA_CLI_APP_SSL_CERT:
    • SWA_CLI_APP_SSL_KEY:
    • SWA_CLI_STARTUP_COMMAND:
    • SWA_CLI_VERSION: 1.1.8
    • SWA_CLI_SERVER_TIMEOUT: 60
    • SWA_CLI_OPEN_BROWSER: false
  • auth:
    [swa] - rolesSource: /api/roles
    [swa] - identityProviders:
    [swa] - google:
    [swa] - registration:
    [swa] - clientIdSettingName: GOOGLE_CLIENT_ID
    [swa] - clientSecretSettingName: GOOGLE_CLIENT_SECRET
    [swa] checking storage content
    [swa] remote dev server detected.
    [swa] - url: /service-worker.js
    [swa] - target: http://localhost:5152
    [swa] customUrl: false
    [swa] is4xx: false
    [swa] remote dev server detected. Proxying request
    [swa] - url: /service-worker.js
    [swa] - code: 200
    [swa] GET http://localhost:5152/service-worker.js (proxy)
    [swa] Connected to tcp:127.0.0.1:5152 successfully
    [swa] http://localhost:5152 validated successfully
    [swa] getting response from dev server
    [swa] GET http://localhost:4280/service-worker.js - 304
    [swa] Connected to tcp:localhost:5152 successfully
    ...
    checking auth request
    [swa] - auth request detected
    [swa] processing auth request
    [swa] - auth returned 404
    [swa] GET http://localhost:4280/.auth/login/google?post_login_redirect_uri=/useredit - 404

Metadata

Metadata

Assignees

No one assigned

    Labels

    command: startAll issues related to the start commandos: windowsIssues happened on a Windows environment (not WSL).priority: medium (P1)Medium priorityscope: authIssues related to the authentication emulatortype: bugSomething isn't workingversion: gaIssues related to major/GA releases

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions