ruanyf / node-oauth-demo

A very simple demo of OAuth2.0 using node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A very simple demo of OAuth 2.0 using Node.js,to add GitHub login to your app and access GitHub API.

This demo is slightly modified from sohamkamani's node-oauth-example. More details in his blog (English) or my blog (Chinese).

Step one: register the app

Register the app on Github : https://github.com/settings/applications/new .

Once register, you will get a client ID and a client secret.

Step two: get the code

First, clone the repo.

$ git clone git@github.com:ruanyf/node-oauth-demo.git
$ cd node-oauth-demo

Second, modify the config.

  • index.js: replace the values of the clientID and clientSecret variables.
  • public/index.html: replace the values of the client_id variable.

Third, install the dependencies.

$ npm install

Step three: run the server

Now, run the server.

$ node index.js

Visit http://localhost:8080 in your browser, and click the link to login GitHub.

About

A very simple demo of OAuth2.0 using node.js


Languages

Language:JavaScript 54.3%Language:HTML 45.7%