Open ghost opened 5 years ago
Same.
Last update was a year ago, this probably broke due to updates. I might make a replacement module tbh.
This still works fine for me are you sure you set the clientSecret: CLIENT_SECRET,
?
After digging the source code I have found out that if you some parameters wrong to the strategy it gives you this error. Also the callback url should be a global url like https://example.com/discord/auth/ not like /discord/auth.
After digging the source code I have found out that if you some parameters wrong to the strategy it gives you this error. Also the callback url should be a global url like https://example.com/discord/auth/ not like /discord/auth.
Yeah, I faced the same issue if you enter any wrong parameter to the strategy it will fail.
Also the callback url should be a global url like https://example.com/discord/auth/ not like /discord/auth.
Cannot confirm, works fine without a global url. However, can confirm that if you encounter this error, double check your token/secret and that they are properly set.
Please make sure to double check your Client ID && Secret, because I didn't pay attention to them and spent an hour trying to debug a problem that was occuring because my secret was missing a hiphon 😐. Pain.
Even after checking all of the parameters to the Strategy it still does this for me.
TokenError at Strategy.OAuth2Strategy.parseErrorResponse (/home/runner/botlistw-1/node_modules/passport-discord/node_modules/passport-oauth2/lib/strategy.js:358:12) at Strategy.OAuth2Strategy._createOAuthError (/home/runner/botlistw-1/node_modules/passport-discord/node_modules/passport-oauth2/lib/strategy.js:405:16) at /home/runner/botlistw-1/node_modules/passport-discord/node_modules/passport-oauth2/lib/strategy.js:175:45 at /home/runner/botlistw-1/node_modules/passport-discord/node_modules/oauth/lib/oauth2.js:191:18 at passBackControl (/home/runner/botlistw-1/node_modules/passport-discord/node_modules/oauth/lib/oauth2.js:132:9) at IncomingMessage.<anonymous> (/home/runner/botlistw-1/node_modules/passport-discord/node_modules/oauth/lib/oauth2.js:157:7) at IncomingMessage.emit (events.js:326:22) at endReadableNT (_stream_readable.js:1241:12) at processTicksAndRejections (internal/process/task_queues.js:84:21)
Can you post a short & reproduceable code sample ( like on Stackoverflow )
After digging the source code I have found out that if you some parameters wrong to the strategy it gives you this error. Also the callback url should be a global url like https://example.com/discord/auth/ not like /discord/auth.
When I'm using the callback URL like this:
router.get( "/redirect", passport.authenticate("discord", { failureRedirect: "/" }), function (req, res) { res.redirect("/info"); } // auth success );
only then the error trigger, so is it safe to redirect the user without passport middleware?
i tried to check user login status with this method req.isAuthenticated(), its reponse is false
After digging the source code I have found out that if you some parameters wrong to the strategy it gives you this error. Also the callback url should be a global url like https://example.com/discord/auth/ not like /discord/auth.
Yeah, I faced the same issue if you enter any wrong parameter to the strategy it will fail. i still get the error
i still get the error
https://stackoverflow.com/help/how-to-ask
You get the error because of user-error, your parameters are wrong can you provoide a minimal repoduceable sample code....?
I got this error, it was because i was using public key instead of client secret. I'm pretty dumb i know, but i'm sharing in case anyone is as dumb as me.
I got this error, it was because i was using public key instead of client secret. I'm pretty dumb i know, but i'm sharing in case anyone is as dumb as me.
Thanks benji4411, i also did the same thing 😂, it worked now.
Whenever I go to /api/login/discord, it works normally and redirects me to the discord link. Once authorized, I get redirected to /api/discord/callback but with a TokenError.
TokenError at Strategy.OAuth2Strategy.parseErrorResponse ([Working Directory]\node_modules\passport-oauth2\lib\strategy.js:358:12) at Strategy.OAuth2Strategy._createOAuthError ([Working Directory]\node_modules\passport-oauth2\lib\strategy.js:405:16) at [Working Directory]\node_modules\passport-oauth2\lib\strategy.js:175:45 at [Working Directory]\node_modules\oauth\lib\oauth2.js:191:18 at passBackControl ([Working Directory]\node_modules\oauth\lib\oauth2.js:132:9) at IncomingMessage. ([Working Directory]\node_modules\oauth\lib\oauth2.js:157:7)
at IncomingMessage.emit (events.js:202:15)
at endReadableNT (_stream_readable.js:1129:12)
at processTicksAndRejections (internal/process/next_tick.js:76:17)
Code here: https://pastebin.com/ji1fr5EF