google-oauth-middleware
Express/connect middleware to authenticate with Google OAuth. No Passport pre-req.
This is better than passport in some cases such as needing to authenticate multiple Google accounts to use.
Install
npm i "google-oauth-middleware"
Usage
// the redirect path;; // setup the authenticator; // redirects to Google OAuth Consent Screen// you can also define multiple .authenticate(scope)// to authenticate with different scopesapp.get'/addGoogleAccount', googleOAuth.authenticate; // this is triggered on authentication from Googleapp.getredirectPath, // this triggers the authenticator googleOAuth.authenticate, // success, // fail (this will be triggered when error handling // the credentials in the googleOAuth i.e. adding to db);