docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a user authentication system that integrates Google OAuth 2.0 authentication and manages user profile data efficiently.
Your system should:
/**
* Configures and initializes the Google OAuth 2.0 authentication strategy
* @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 - Callback URL for OAuth flow
* @returns {void}
*/
function configureAuth(config) {
// Implementation
}
/**
* Extracts essential profile fields from Google profile object
* @param {Object} profile - Google user profile object
* @returns {Object} Object with id, displayName, and email fields
*/
function extractProfileData(profile) {
// Implementation
}
/**
* Stores user profile data in memory
* @param {Object} profileData - User profile data with id, displayName, and email
* @returns {void}
*/
function storeUserProfile(profileData) {
// Implementation
}
/**
* Retrieves stored user profile by user ID
* @param {string} userId - Google user ID
* @returns {Object|null} User profile data or null if not found
*/
function getUserProfile(userId) {
// Implementation
}
module.exports = {
configureAuth,
extractProfileData,
storeUserProfile,
getUserProfile
};Provides authentication middleware for Node.js applications.
Provides Google OAuth authentication strategies for Passport.