API Authentication with Node - Part #9 - OAuth Explained

in #technology7 years ago

Description 💻

In the ninth part of API authentication with Node series, we'll learn about OAuth (OAuth2). The OAuth flow can be tricky, especially when trying to understand it for the first time.

The fact that doesn't help it is that there are two different ways of handling OAuth.

First way - you use OAuth in server-side rendered application in which your backend code will pretty much handle everything.

Second way - (the one that we're going for) is the case of single page application (SPA) in which we have separate frontend and backend servers.

In this approach, OAuth is going to be pretty much split into two pieces. One piece will be handled on the frontend, while the other piece will be handled on the backend.

The frontend will need to get access to accessToken, while the backend will actually exchange accessToken for user profile and take care of things from there.

In case you're looking to learn Node, Express, MongoDB, React, client-side validation, server-side validation and more this series should be interesting to you.

Video 🎥

Want to support CodeWorkr? 💖 🌍

To be clear - I'm creating these posts/videos because I enjoy it and I like helping others when I can without expecting anything in return, however, in case you like these posts and I mean you've got to really, really like them to read this section - and would like to support me, first of all, that'd be amazing - thank you very much, secondly, these are some of the ways you can help:

  • Upvote this post
  • Send STEEM to @codeworkr
  • Follow CodeWorkr on Steemit
  • Subscribe to CodeWorkr on Youtube
  • Follow CodeWorkr on Twitter
  • Like CodeWorkr on Facebook
  • BTC 1PAtL34zjj8hKfVziZVe5Yz6HCH7G2iYyx
Sort:  

Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://www.youtube.com/watch?v=H0IxtqZ08Jo

Thanks for linking to my own video linked above, bot! ;)

The @OriginalWorks bot has determined this post by @codeworkr to be original material and upvoted it!

ezgif.com-resize.gif

To call @OriginalWorks, simply reply to any post with @originalworks or !originalworks in your message!

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by codeworkr from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews/crimsonclad, and netuoso. The goal is to help Steemit grow by supporting Minnows and creating a social network. Please find us in the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP. Be sure to leave at least 50SP undelegated on your account.

Congratulations @codeworkr! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You got your First payout
Award for the number of upvotes received

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!