serverless / platform-sdk

Serverless Platform SDK
Apache License 2.0
17 stars 7 forks source link

Local host for backend #85

Closed astuyve closed 4 years ago

astuyve commented 5 years ago

Use localhost:3011 for LOCAL to allow you to login to a local cli. This fixes a bad-request error that would result from Auth0 storing the user's auth code along with the redirectURL provided by the originating requester.

Issue:

  1. you log in from the CLI with SERVERLESS_PLATFORM_STAGE=local sls login
  2. that bounces you through localhost:3000 frontend -> auth0
  3. Auth0 STORES the domain localhost:3000 along with your auth code to fetch tokens
  4. Auth0 redirects you back to localhost:3000 frontend
  5. localhost:3000 frontend passes that code to the server (in sdk versions 2.1.0 and earlier)
  6. CLI then requests from api.serverless-dev.com for tokens with your code
  7. DEV dashboard calls out to auth0 with your code and sets the redirectURL to dashboard.serverless-dev.com (Dev frontend)
  8. auth0 returns a bad client ID because dashboard.serverless-dev.com is the redirect URL, not localhost:3000