Redirect
Redirect Based on Value from Cookies
π¨βπΌ It's the moment we've all been waiting for! In this step we're going to do
three basic things
in :
- Read the
redirectTovalue from therequestusing thegetRedirectCookieValueutility - Safely redirect the user to
redirectTowherever we're redirecting the user. - Destroy the
redirectTocookie 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/profileand logged in
Good luck!