Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

255
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda