Problems with Curl in Discord Oauth2

Problems with Curl in Discord Oauth2

By : user2185119
Date : November 20 2020, 04:01 AM
hop of those help? the problem is simple. , Problem solved :D
code :
    $info = curl_init();

    curl_setopt_array($info, array(
        CURLOPT_URL => "https://discordapp.com/api/oauth2/token",
        CURLOPT_POST => 1,
        CURLOPT_POSTFIELDS => array(
            "grant_type" => "authorization_code",
            "client_id" => $data['id'],
            "client_secret" => $data['secret'],
            "redirect_uri" => $data['redirect'],
            "code" => $data["code"],

    $tinyresult = curl_exec($info);
    if ($tinyresult == false) {
        $tinyerror = curl_error($info);
    } else {
        $tinyerror = null;
        $tinyresult = json_decode($tinyresult);

    $httpcode = curl_getinfo($info, CURLINFO_HTTP_CODE);


    return array(
        "data" => $tinyresult,
        "err" => $tinyerror,
        "state" => $httpcode,

Share : facebook icon twitter icon
Discord Oauth2 Join Guild

Discord Oauth2 Join Guild

By : MaximoN
Date : March 29 2020, 07:55 AM
wish help you to fix your issue , I just had to replace the ContentType to "Content-Type"
code :
headers: {
  "Authorization": "Bot [botToken]",
  "Content-Type": "application/json",
How to securely store the Access-Token of a Discord(OAuth2) User?

How to securely store the Access-Token of a Discord(OAuth2) User?

By : Andreas Lindenberg
Date : March 29 2020, 07:55 AM
like below fixes the issue BORING STORY:
I would like to start with the premise that I have seen online banking applications sending authentication tokens as plain text appended as a query string in a POST.
code :
function randomID(size, type) {

    // SEEDS
    const special = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~`!@#$%^&*()_-+={[}]|:;<,>.?/0123456789";
    const alphaNum = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    const alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
    const num = "0123456789";

    let x, y, z;
    let currentIndex;
    let randomIndex;
    let temporaryValue;

    let i;

    if (type === 'special') {
        x = special;
    } else if (type === 'alphaNum' || type === 'unique') {
        x = alphaNum;
    } else if (type === 'alpha') {
        x = alpha;
    } else {
        x = num;

    x = x.split();
    currentIndex = x.length;

    while (currentIndex !== 0) {
        randomIndex = Math.floor(Math.random() * currentIndex);
        temporaryValue = x[currentIndex];
        x[currentIndex] = x[randomIndex];
        x[randomIndex] = temporaryValue;
    x = x.toString();

    y = '';
    if (type === 'unique') {
        z = new Date();
        y += x.charAt(x.length - 1 - z.getDate());
        y += x.charAt(x.length - 1 - z.getHours());
        y += z.getFullYear().toString();
        y += x.charAt(x.length - 1 - z.getMonth());
        y += x.charAt(x.length - 1 - z.getMinutes());
        y += x.charAt(x.length - 1 - z.getSeconds());
        y = y.split('').reverse().join('');
        y += '-';

    for (i = 0; i < size; i++) {
        y += x.charAt(Math.floor(Math.random() * x.length));

    return y;

Discord Oauth2 receiving 'invalid client' error

Discord Oauth2 receiving 'invalid client' error

By : Sarah Ziska
Date : March 29 2020, 07:55 AM
I hope this helps you . The query parameters should be in the BODY of the POST request, not the URL for the oauth/token url.
Discord recently pushed a update to the oAuth2 which makes it confine more with the standard. This means they no longer support parameters in the URL for POST, but instead require them to be in the body and form encoded (basically the same, but in the body and without the leading ?).
code :
Discord oAuth2 login after authorization was given

Discord oAuth2 login after authorization was given

By : user3148128
Date : March 29 2020, 07:55 AM
Does that help At the time I was working on this I didn't had much time and only briefly looked into the documentation.
Now I have had more time and put some time into reading the whole documentation of Discords oAuth.
How would I authorize users using Discord Oauth2.0 for Firebase Authentication on the Web

How would I authorize users using Discord Oauth2.0 for Firebase Authentication on the Web

By : Swetha
Date : March 29 2020, 07:55 AM
Does that help How would I authenticate users with Discord's OAUTH Api (https://discordapp.com/developers/docs/topics/oauth2) for Firebase? , Here is my recommendation :
1.Build Firebase Cloud Function
Related Posts Related Posts :
  • LibreOffice convert PDF to Word as textbox instead normal document
  • php laravel swift email sending problems
  • Reload PHP file in command line PHP-CLI
  • how do I fetch a certain part out of an database?
  • CodeIgniter URL Route with ID and title
  • Add a header to each column
  • How can I loop stdClass in PHP?
  • Four arrays in for each loop
  • bootstrap 4 cards with php foreach loop
  • Codeigniter return not found on the server
  • PHP Codeigniter Do Upload Function Does Not Work
  • Implement REST API Symfony 3
  • how to add show data button in Yajrabox
  • My WampServer doesnt have apache setting in tray icon
  • Translate checkout fields validation error notices in Woocommerce
  • Embedding nested form type fields in empty symfony form
  • PHP Laravel orderby not working if using `count`
  • Laravel 5.7 my model from my parameter return's empty when i dump it
  • How to pass input value as array instead of passing only one value where array_walk is used in PHP?
  • Replace illegal charactes in a text by underscore in PHP
  • PHP / JSON - Return large string result in error
  • Yii2 DI container: registering same class twice, but with different constructor parameters
  • Creating Subdirectories with a for loop
  • Wordpress get most popular posts in current post category
  • Replace linebreak in specific piece of text in file
  • Update database that has same key with using a new different values
  • How to remove all lines in file till a specific word occures PHP
  • How to use Join in Codeigniter for update Query
  • PHP DOMDocument: may a text node be reused?
  • How to read Armenian texts from Laravel MSSQL database
  • How to view image and pdf files preview in yii2 kartik multiple file upload in update form
  • Which one is best and faster method ?(making drop down method)
  • Using preg_match to get content between tags
  • Laravel 5.7 Eloquent
  • How to combine array inside foreach loop
  • Wordpress-Stripe Integration: Fatal error: Uncaught Error: Class 'Stripe' not found
  • Redirect user to original url from age verification
  • How to update only one input in Laravel form?
  • How to add language translation in JSON file in prestashop
  • Interface 'Monolog\ResettableInterface' not found when running a new project
  • Adding strings when using echo in foreach PHP
  • do-while loop only runs once
  • Need to trim string
  • Increment ID by one on duplicate with PHP
  • insert current date time using laravel
  • call_user_func_array("shell_exec", ...) not working in php
  • PHP Time Validator to accept 1 digit number for hour and minutes
  • How to swap element according to condition in PHP where there is array_map?
  • PHP Compress Image and rename
  • PHP 'Delete all between' specific words
  • PHP - Show database values in text boxes
  • Merged description and additional information. Border not extending to content
  • Hide on sale products from a shortcode on homepage in Woocommerce
  • Can i use empty() for a Undefined Variable?
  • Display array from php using html form checkbox
  • Add a custom taxonomy filter after product category filter in Woocommerce Admin products list
  • CSV Import Super Slow after upgrading to PHP 7.1 only on live server
  • Order a PHP Dropdown Menu by ID as Opposed to Alphabetical Order
  • I am getting this error Error: Incorrect time value: '16:44:09 PM' for column 'time' at row 1 and I'm not sure why
  • Not Able to Load All WP-QUERY result to JSON Encode in Custom Loop
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org