Implementing GitHub Login with Two-Factor Authentication
00:00 It's finally time to make it so that when you click a login with GitHub, you actually log in with GitHub. In this exercise, there's actually not a whole lot for us to do. We just need to create a session. First of all, you need to make sure that this profile ID, here's the connection that they have, and so this is the user that's logging in.
00:19 Once you determine that, then you can create the session, and then we just need to do the exact same thing that we're already doing in our login, which involves creating or putting that session in the cookie. But the cool thing is that our login already handles two-factor authentication, and so we want to reuse all of that logic.
00:39 If the user has logged in with GitHub, but they also have 2FA, then we want to have them go through that flow. We're going to take a bit of a refactor. You're going to move some stuff that's in the action of our login. We're going to move it into a function and then reuse that function right in here. That's actually not a whole lot of lines changed.
00:58 You're just going to be moving some code around and adding a bit of code. It's actually pretty cool. Especially, I recommend you test it out with a user that has two-factor authentication enabled, because it's super cool to go through the GitHub login flow and include two-factor auth. Have a good time with that, and we'll see you when you're done.