Error: Invalid OAuth2 redirect_uri

I have been trying to integrate Discord as a Provider in an Application that uses Strapi v3. Despite following the guide specified on the website (Documentation) I wasn’t able to reach my goal: Authenticate users in Strapi via Discord.

After many attempts, I have encountered the following error repeatedly and couldn’t conclude if it is an error due to new updates or if I am doing anything wrong.

Thanks for your time and hope to receive your help! ; )

Found any fix? I also encountered this problem. I think it comes from this part in the url:
&response_type=code&redirect_uri=http%3A%2F%2F0.0.0.0%3A1337%2Fapi%2Fconnect%2Fdiscord%2Fcallback&scope=identify%20email.

0.0.0.0:1337 surely isn’t a valid uri but I dont know where does it come from and how to change it

Coming back on this one for anyone that might encounter the same issue in the future:

The issue appeared because I forgot to set an URL in .env and reference it in server.js

In order to fix it:

  1. Add your URL in .env
URL=https://your-strapi.com
  1. Reference it in server.js
module.exports = ({ env, }) => ({
	host: env('HOST', '0.0.0.0'),
	port: env.int('PORT', 1337),
	proxy: true,
	url: env('URL', '0.0.0.0:1337'),
        .................................
});