Azure / static-web-apps-cli

Azure Static Web Apps CLI ✨
https://aka.ms/swa/cli-local-development
MIT License
600 stars 119 forks source link

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

Open Bronzato1 opened 5 months ago

Bronzato1 commented 5 months ago

Are you accessing the CLI from the default 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):

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


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:

teddy-humpert commented 4 months ago

For what it's worth, I was having the same issue and after going through a bunch of troubleshooting, downgraded SWA CLI version to 1.1.7 and it's back to functional.

bzbetty commented 4 months ago

curiously it looks like they were actually adding support for 3rd party auth to swa cli - could be nice to have but it certainly seems half baked at present and wasn't really publicized.

https://github.com/Azure/static-web-apps-cli/commit/27d579716572fcb4cddb67cadb9bc1094597582e