Redirect
Loading "Redirect Based on Value from Cookies"
Run locally for transcripts
π¨βπΌ It's the moment we've all been waiting for! In this step we're going to do
three basic things
in :
- Read the
redirectTo
value from therequest
using thegetRedirectCookieValue
utility - Safely redirect the user to
redirectTo
wherever we're redirecting the user. - Destroy the
redirectTo
cookie with thedestroyRedirectToHeader
The tricky bit here is we've got a couple places where we redirect the user, so
we'll need to handle all of those. In some cases we'll even need to include a
redirectTo
query param to forward the redirectTo
logic to the next step.Here's how you test this out:
- Be logged out
- Go to
- You'll be redirected to
/login
- Click "Login with GitHub"
- You should be redirected to
/settings/profile
and logged in
Good luck!