Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

257
Visualizações
How do I solve Redirect URI is not supported by the client in Discord OAuth2

Hey there StackOverflow community 👋. I'm implementing a web app which brings out all the possible information of a Discord user. Currently in the backend of my project I use express | passport | passport-discord (I am also following a tutorial on YouTube). The relevant code is

strategies/discord.js

const DiscordStrategy = require('passport-discord').Strategy;
const passport = require('passport');
const config = require('config');
var scopes = ['identify', 'email', 'guilds'];

passport.use(new DiscordStrategy({
    clientID: config.get('discord.clientID'),
    clientSecret: config.get('discord.clientSecret'),
    callbackURL: config.get('discord.redirectURL'),
    scope: scopes
}, (accessToken, refreshToken, profile, done) => {
    console.log(profile.id);
    console.log(profile.accent_color);
}));

routes/auth.js

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

/* GET users listing. */
router.get('/', passport.authenticate('discord'));

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

module.exports = router;

config/default.json

{
    "apiName": "Discord Profiler API",
    "discord": {
        "clientID": "xxx-xxx-xxx-xxx-xxx-xxx",
        "clientSecret": "xxxxxxxxxxxxxxxxxxx",
        "redirectURL": "localhost:9999/auth/redirect"
    },
    "port": 9999
}

The steps when debugging my project where:

  1. Hitting the route /auth in my browser
  2. It takes me to the Discord Authorization page (typically)
  3. Clicking the authorize button leads me to this page;

Error gotten from Discord authorization page redirect

But I have defined all the routes and test them to see if they work, and they all do. If your curious about the YouTube video I got this from this is the link

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

I know I'm late, but always make sure you add "http://" before the localhost and it should work!!

It must be http and not https since its a local address and can't have a SSL certificate

about 4 years ago · Juan Pablo Isaza Relatório

0

Can you check if you're missing the scheme part? it should be http://localhost:9999/auth/redirect

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda