You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@types/passport-google-oauth20

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/passport-google-oauth20

TypeScript definitions for passport-google-oauth20


Version published
Weekly downloads
126K
increased by3.41%
Maintainers
1
Install size
2.21 MB
Created
Weekly downloads
 

Package description

What is @types/passport-google-oauth20?

@types/passport-google-oauth20 provides TypeScript type definitions for the passport-google-oauth20 package, which is a Passport strategy for authenticating with Google using the OAuth 2.0 API.

What are @types/passport-google-oauth20's main functionalities?

Google OAuth 2.0 Strategy

This feature allows you to set up the Google OAuth 2.0 strategy for Passport. It involves configuring the strategy with your Google client ID, client secret, and callback URL, and defining a function to handle the user profile returned by Google.

const GoogleStrategy = require('passport-google-oauth20').Strategy;

passport.use(new GoogleStrategy({
  clientID: process.env.GOOGLE_CLIENT_ID,
  clientSecret: process.env.GOOGLE_CLIENT_SECRET,
  callbackURL: 'http://www.example.com/auth/google/callback'
},
function(accessToken, refreshToken, profile, done) {
  User.findOrCreate({ googleId: profile.id }, function (err, user) {
    return done(err, user);
  });
}));

Authentication Middleware

This feature demonstrates how to set up routes for initiating Google authentication and handling the callback after authentication. The middleware uses the Google strategy to authenticate users and handle success or failure scenarios.

app.get('/auth/google',
  passport.authenticate('google', { scope: ['https://www.googleapis.com/auth/plus.login'] }));

app.get('/auth/google/callback', 
  passport.authenticate('google', { failureRedirect: '/login' }),
  function(req, res) {
    // Successful authentication, redirect home.
    res.redirect('/');
  });

Other packages similar to @types/passport-google-oauth20

Readme

Source

Installation

npm install --save @types/passport-google-oauth20

Summary

This package contains type definitions for passport-google-oauth20 (https://github.com/jaredhanson/passport-google-oauth2).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/passport-google-oauth20.

Additional Details

Credits

These definitions were written by Yasunori Ohoka, Eduard Zintz, Tan Nguyen, and Gleb Varenov.

FAQs

Package last updated on 04 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc