Skip to content

Logging in on staging instances

Jacob Sommer edited this page Jun 1, 2023 · 3 revisions

In order to authenticate with Google there are 2 steps.

  1. Open the authentication URL (which passes a callback url)
  2. Handle the callback in our back end.

The problem with staging instances is that each callback url must be registered in google cloud e.g https://peterportal.org/api/users/auth/callback or http://localhost:5000/api/users/auth/callback. Each staging instances has a unique hostname and it is not feasible to register every callback url.

The workaround is to have the passed callback url be the prod callback URL and then to have prod's backend redirect the callback to staging instance if necessary. In order for the prod backend to know the callback is meant for staging, it is defined using the state parameter in the authentication URL, which gets passed back in the callback.

Clone this wiki locally