0

Production ReactJS app, integrates Spotify Web Api (https://developer.spotify.com/documentation/web-api/reference-beta/) using Google App Engine: https://widget-dashboard-app.appspot.com/

All of the routes (/settings, /about, /contact) work as expected BUT when a user tries to log in to Spotify, the redirect path /settings/#access_token=[BIG-LONG-TOKEN]&token_type=Bearer&expires_in=3600 results in this error via GAE:

Error: Not Found
The requested URL /settings/ was not found on this server.

My first thought is that I have an issue in my app.yaml file:

# [START runtime]
runtime: python27
api_version: 1
threadsafe: true
# [END runtime]

# [START handlers]
handlers:
- url: /
  static_files: build/index.html
  upload: build/index.html
- url: /
  static_dir: build
- url: /.*
  static_files: build/static/\1
  upload: build/static/.*
- url: /settings/.*
  static_files: build/static/\1
  upload: build/static/.*
# [END handlers]

I've scoured the Interwebs in search of what might be the issue for two weeks. I've read all. the. docs.

Actual result should be: User logs in via Spotify's Web API, and is redirected back to https://widget-dashboard-app.appspot.com/settings/#access_token=[BIG-LONG-TOKEN]&token_type=Bearer&expires_in=3600 and their browser will begin playing music within a few seconds. This works in development.

1 Answers1

0

As it's an SPA with your routing handled by the app, you need a catch-all route that lands on your main index.html. So it looks like your wildcard rule should be this:

url: /.*
  static_files: build/index.html
  upload: build/index.html

I don't think you'll need the /settings/ one

Will Jenkins
  • 9,507
  • 1
  • 27
  • 46