Home>
Problem
I want to create a login button with discord on my site, but I get an Invalid \ "redirect_uri \" in request.
The redirect url has already been registered on the Discord Developer page.
Program
<? php
$redirect_url = 'https://bot.midokuriserver.com/webdashboard/setlogin.php';
$code = $_GET ["code"];
$url = 'https://discordapp.com/api/oauth2/token';
// Data to send POST
$data = array (
'client_id' =>'client id',
'client_secret' =>'client secret',
'grant_type' =>'authorization_code',
'code' =>$code,
'redirect_url' =>$redirect_url,
'scope' =>'identify'
);
// URL encoding
$data = http_build_query ($data, "", "&");
// Options when sending
$options = array ('http' =>array (
'method' =>'POST',
'content' =>$data,
'protocol_version' =>'1.1',
'ignore_errors' =>true
));
// create a stream context
$options = stream_context_create ($options);
// file_get_contents
$contents = file_get_contents ($url, false, $options);
// output
echo $contents;
?>
-
Answer # 1
Related articles
- php: there is an error in the insert into line and it cannot be resolved
- i want to put an error bar using standard error (sem) in ggplot2
- php - how to convert from excel to pdf using libreoffice on ec2
- creating an associative array using php and variable names as keys
- i'm using phplaravel and the screen gives an error
- ruby - i get a validation error when using factorybot with rspec
- i want to create a form using html and php
- php parse error: syntax error, unexpected'class' (t_class) error
- php - "doesn't have a default value" error when performing seeding
- php - an error that i personally cannot solve
- php - variable undefined error when updating view file with laravel
- error display on python discord bot
- an error occurs in unit tests with phpunit
- i would like to know the cause of the error php
- output file gets corrupted using phpspreadsheet
- php - in a test using mockey for sns authentication, provider :: stateless () does not exist on this mock object is displayed
- error in callback function in php class
- php - i get an error at the bottom , but i don't know the cause
- php - can't pass the parameters? regarding parameter error
- php - i don't know how to fix "syntax error" after changing wordpress and css
Trends
Check the necessary parameters
Requires parameter redirect_uri