Coder Social home page Coder Social logo

api-oauth-thirdparty's Introduction

##Sehati API

REST API with OAuth by 3rd Party

##REST API with OAuth

List of passport-local routes:

Route HTTP Description
/login GET Print: Login page
/login/local GET Print: Login
/login/local POST req.body (username & password)
/login/exit GET Print: Logout

List of passport-facebook routes:

Route HTTP Description
/login/facebook GET Print: Login page on FB
/login/facebook/callback GET Print: Callback
/login/facebook POST Print: Page on FB
/login/facebook/exit GET Print: Logout

List of passport-twitter routes:

Route HTTP Description
/login/twitter GET Print: Login page on Twitter
/login/twitter/callback GET Print: Callback
/login/twitter POST Print: Page on Twitter
/login/twitter/exit GET Print: Logout

List of passport-google routes:

Route HTTP Description
/login/google GET Print: Login page on Google
/login/google/callback GET Print: Callback
/login/google POST Print: Page on Google
/login/google/exit GET Print: Logout

USAGE

With only npm:

npm init
npm install express
npm install nodemon
npm run dev
npm install jsonwebtoken
npm install password-hash
npm install --save dotenv
npm install mongoose
npm install passport passport-local
npm install passport-facebook
npm install passport-twitter
npm install express-session
npm install passport-google-oauth20

Mongoose (db):

sudo service mongod start
connection @robomongo
mongo
use user
create file connection: db.js

IMPORTANT

Using passport local: //Must first position in app.use app.use(passport.initialize());

Correct Structure:

  1. passport.session
  2. cookieParser
  3. session
  4. app.router
Special for CRUD using Token in headers (postman):

P.s. Token will get when sign in as Admin

Access the website via http://localhost:3000 or API via http://localhost:3000/login
Debugger encode & decode via https://jwt.io/

api-oauth-thirdparty's People

Contributors

tamatamvan avatar isumizumi avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.