Google OAuth authentication strategies for Passport.js
94
Build an authentication system that allows users to sign in with their Google account and grants access to their Google Calendar and Drive data.
Your system should implement a Google OAuth 2.0 authentication flow with the following features:
Configure authentication to request access to:
Implement three HTTP route handlers:
/auth/google): Initiates the OAuth flow with the appropriate permissions/auth/google/callback): Handles the OAuth callback after user authorization/profile): Returns the authenticated user's Google profile information and access token/profile on success/login-failed on failure/auth/google, they are redirected to Google's OAuth consent page @test/profile @test@generates
/**
* Configures and returns an Express router with Google OAuth authentication routes.
*
* @param {Object} config - Configuration object
* @param {string} config.clientID - Google OAuth client ID
* @param {string} config.clientSecret - Google OAuth client secret
* @param {string} config.callbackURL - OAuth callback URL
* @returns {Router} Express router with authentication routes configured
*/
function createAuthRouter(config) {
// IMPLEMENTATION HERE
}
module.exports = { createAuthRouter };Provides authentication middleware for Node.js applications.
Provides Google OAuth authentication support.
Provides web application routing and middleware support.
Install with Tessl CLI
npx tessl i tessl/npm-passport-google-oauthdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10