WIKI.logger.warn(`GitHub OAuth: No email found in profile for user ${profile.id||profile.username}. Make sure 'user:email' scope is granted.`)
}
constuser=awaitWIKI.models.users.processProfile({
providerKey:req.params.strategy,
profile:{
@ -34,9 +42,19 @@ module.exports = {
picture:_.get(profile,'photos[0].value','')
}
})
WIKI.logger.info(`GitHub OAuth: Successfully authenticated user ${user.email}`)
cb(null,user)
}catch(err){
cb(err,null)
WIKI.logger.warn(`GitHub OAuth: Authentication failed for strategy ${req.params.strategy}:`,err)
// Provide more user-friendly error messages
if(err.message&&err.message.includes('email')){
cb(newError('GitHub authentication failed: Email address is required but not available. Please ensure your GitHub account has a verified email address and grant email access permissions.'),null)
cb(newError('Google authentication failed: Email address is required but not available. Please ensure your Google account has a verified email address.'),null)