In this tutorial we look at how to build a “Sign in with Github” OAuth solution. We will use node to build the backend with 3 routes and a frontend to go with it with HTML, CSS and Javascript. We will also look at how to create a new OAuth application in Github.com.
The routes we need are “/”, “/auth” and “/oauth-callback”. We will send the user to github once they click the sign in button. We will pass the clientId of our oauth app so that Github knows from where the user came. If the user signs in to Github or just press "Accept if they were already logged in they will be redirected to our site on the route which we specified. In this case it is “oauth-callback”. Github will give us a code that we can use to retrieve an authorization token from Github and then we can use that token to access some data from their Github profile.

Hope you enjoy the tutorial!

Code: https://github.com/danba340/oauth-github-example

#oauth #node #javascript #html #css

Simplified Oauth 2.0 Tutorial - Example with Node.js
1.80 GEEK