GithubHelp home page GithubHelp logo

supuna97 / expressjs-passport-oauth2 Goto Github PK

View Code? Open in Web Editor NEW
12.0 1.0 1.0 251 KB

This is a simple example of how to use passport with oauth2. It uses the google strategy to authenticate users.

License: Apache License 2.0

JavaScript 100.00%
express-passport expressjs nodejs nodejs-express nodejs-express-mysql nodejs-expressjs oauth2 oauth2-authentication passport passport-oauth2

expressjs-passport-oauth2's Introduction

Express with passport Oauth2

Description

This is a simple example of how to use passport with oauth2. It uses the google strategy to authenticate users.

Installation

  1. Clone the repository
  2. Run npm install
  3. Create a .env file in the root directory and add the following variables:
NODE_ENV=development
PORT=3000
APP_SECRET=your_app_secret

# Database
DB_HOST=localhost
DB_PORT=3306
DB_CONNECTION=mysql
DB_USERNAME=your_db_user
DB_PASSWORD=your_db_password
DB_NAME=your_db_name

# Google Oauth2
OAUTH2_AUTHORIZATION_URL=https://accounts.google.com/o/oauth2/v2/auth
OAUTH2_TOKEN_URL=https://oauth2.googleapis.com/token
AUTH_CLIENT_ID=your_client_id
AUTH_CLIENT_SECRET=your_client_secret
AUTH_CALLBACK_URL=http://localhost:3000/auth/google/callback
  1. Run npm start
  2. Open your browser and go to http://localhost:3000

License

Apace 2.0

expressjs-passport-oauth2's People

Contributors

dependabot[bot] avatar supuna97 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

botlk

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.