nicholastay / passport-discord

Passport strategy for authentication with Discord (discordapp.com)
ISC License
172 stars 55 forks source link

Error: Unknown authentication strategy "discord" #32

Open Mercy1127 opened 3 years ago

Mercy1127 commented 3 years ago

Error: Unknown authentication strategy "discord" at attempt (C:\Users\#####\djs-bot\backend\node_modules\passport\lib\middleware\authenticate.js:190:39) at authenticate (C:\Users#####\djs-bot\backend\node_modules\passport\lib\middleware\authenticate.js:367:7) at Layer.handle [as handle_request] (C:\Users#####\djs-bot\backend\node_modules\express\lib\router\layer.js:95:5) at next (C:\Users#####\djs-bot\backend\node_modules\express\lib\router\route.js:137:13) at Route.dispatch (C:\Users#####\djs-bot\backend\node_modules\express\lib\router\route.js:112:3) at Layer.handle [as handle_request] (C:\Users#####\djs-bot\backend\node_modules\express\lib\router\layer.js:95:5) at C:\Users#####\djs-bot\backend\node_modules\express\lib\router\index.js:281:22 at Function.process_params (C:\Users#####\djs-bot\backend\node_modules\express\lib\router\index.js:335:12) at next (C:\Users#####\djs-bot\backend\node_modules\express\lib\router\index.js:275:10) at Function.handle (C:\Users#####\djs-bot\backend\node_modules\express\lib\router\index.js:174:3)

tonestrike commented 3 years ago

Can you provide your implementation code?

KingCh1ll commented 3 years ago

We cannot help you unless you provide your code.

CringeKidy commented 3 years ago

hey i have the same problem.

i am following this guys tutorial: https://www.youtube.com/watch?v=DomtnrQ4f3Q (this is get a understanding of what the layout is)

here is the code for my auth.js file

const router = require('express').Router();
const passport = require('passport')

router.get('/discord', passport.authenticate('discord'));

router.get('/discord/callback', passport.authenticate('discord', {
    failureRedirect: '/'
}), function(req, res) {
    res.redirect('/secretstuff') // Successful auth
});

module.exports = router; 
CringeKidy commented 3 years ago

Nvm i figure out that i didn't have the passport strat

MaikyDev1 commented 3 years ago

I have the same issue..

Here is the strategy: https://pastebin.com/MwtYCc3A

CringeKidy commented 3 years ago

hey @M4iky1 do you have your strat in the route for my problem i didnt have the start getting called anywhere

https://codepen.io/cringekidy/project/editor/AwpbjL have a look here to see what i am talking about

MaikyDev1 commented 3 years ago

thanks!