Azure / Azure/static-web-apps-cli

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

Abierto
#840 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

command: start os: windows priority: medium (P1) scope: auth type: bug version: ga
Lenguaje dominante
TypeScript
Estrellas
668
Forks
155
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce el fallo con swa start http://localhost:5152/ --api-location http://localhost:7238/ y el staticwebapp.config.json mostrado; después, inspecciona los registros de solicitudes de autenticación de --verbose=silly. Se considera completado cuando la solicitud a / .auth/login/google llega al portal de autenticación local de Azure Static Web Apps Emulator en lugar de devolver el error de ID de cliente.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
azure, node.js, typescript
Área
authentication, cli, cloud
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.