Skip to content

Instantly share code, notes, and snippets.

@hero9
Created April 23, 2020 18:18
Show Gist options
  • Save hero9/a20f65a3bb09d9597509ea7bc6e214f1 to your computer and use it in GitHub Desktop.
Save hero9/a20f65a3bb09d9597509ea7bc6e214f1 to your computer and use it in GitHub Desktop.
Step 1: On the front-end, get the 3rd party authentication provider login popup to appear.
Step 2: (Still on the front-end) Grab the access token the provider returns after agreeing to login.
Step 3: (Yep, still front-end) Send that token to the back-end as part of the input argument of your mutation.
Step 4: On the back-end, verify the token.
Step 5: If the token is authentic, you will receive the user as part of the verification response (at least that’s the case with Passport.js, which we’ll be using).
Step 6: Save the user’s data to your database.
Step 7: Return a JWT to the front-end. What you do with that token is out of scope for this tutorial, but it should probably be used to authenticate each of the logged in user’s actions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment