Loading
Current section: Redirect Cookie 5 exercises
Problem

Handling Redirects and Cookies

Loading exercise

Transcript

00:00 For this section, now that we've got this redirect to getting into the form, we got to go from the form into the cookie. And so that's your objective here. You've done cookies before. So Kelly, the coworker put together this redirect cookie utility for us. And so there are a couple of pieces or utilities here. The one you're going to focus on

00:18 is this get redirect cookie header. We also have another utility you're going to be using called get referrer that you'll be using to give a good default for what the redirect should be. But yeah, this is going to give us the cookie that we're going to set and persist that redirect to on.

00:37 Another thing that you need to know about is the authenticator. When you say authenticate, that's going to throw a redirect response. Also our mock, our mock that throws the response, that's also throwing a redirect response. And so in our implementation, we're going to add a try catch, and then we'll check if that error is a response object.

00:56 Then we'll just append the cookie to that response object. So that is what you're going to be doing in this exercise. Have a good time.