Giter Club home page Giter Club logo

discord-oauth2-php's Introduction

Welcome on my profile!

My name is Christian Chaux and I'm a software developer, mainly doing C# but sometimes a bit of JS/TS and C++
I also like working on some personal projects on my free time, all of them are on my GitHub (scroll down a bit to see them!)

Aside from programming, I also enjoy playing some video games or reading books, feel free to check my website if you want to know more

Contact

You can either send me a mail or add me on Discord (either by adding Zirk#0001 or by coming to my support server)

About my projects

Need help/new feature?

Feel free to open issues on the GitHub page of my projects if you need anything, you can also just contact me if you want to speak directly

Depending of the project I may or not add it (depending of the size of the feature and if I'm still maintaining the project), but hey, you might as well try

Contributing

I'm accepting pull requests on all my projects, feel free to fork them and add stuff.

Others

If you want to support me, please star the projects you like!
If you want to go further, I also have a GitHub sponsor

Footnote

I wish I had more hot color in my "Pinned Projects" section but I guess I'm condemned to use languages that are either green or blue

discord-oauth2-php's People

Contributors

trentwiles avatar xwilarg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

discord-oauth2-php's Issues

Undefined index: id (Guild)

hello I wanted to make a server query but every time I wanted to query the Guild ID it says in the console that id was not found. The same is also when I try this with the getCustomInformation variable.

Code:
if($guild["id"] == "909599485204779028") { echo "Willkommen " . $answer["username"] . "#" . $answer["discriminator"]; echo $guilds["id"]; echo '<hr>'; } else { echo "Du musst auf dem ******** Discord Server sein!"; echo $guild["name"]; die(); }
Error Log:

2021-11-30 11:26:12: mod_fastcgi.c.487) FastCGI-stderr:PHP Notice: Array to string conversion in /var/www/html//user/login.php on line 40
2021-11-30 11:26:12: mod_fastcgi.c.487) FastCGI-stderr:PHP Notice: Undefined index: name in /var/www/html/
/user/login.php on line 44
2021-11-30 11:26:49: mod_fastcgi.c.487) FastCGI-stderr:PHP Notice: Undefined index: id in /var/www/html/
/user/login.php on line 37
2021-11-30 11:26:49: mod_fastcgi.c.487) FastCGI-stderr:PHP Notice: Undefined index: id in /var/www/html/
/user/login.php on line 40
2021-11-30 11:26:49: mod_fastcgi.c.487) FastCGI-stderr:PHP Notice: Undefined index: name in /var/www/html/
**********/user/login.php on line 44


If you need more details I can give you access to the repo

Page redirects everytime to the Discord Login Page

Hey I had to redo the whole thing today because some things didn't work anymore and now I notice that I'm constantly redirected to the Discord login page. I have also entered the code 1 to 1 of the example and still the error.

OAuth2 Page Just Refresh

Hello! I have setup this package on my website, and it successfully redirects me to the discord oauth2 page, but every time I click authorize it seems to refresh the page and it's the same. I see this is setup to callback to the redirect url instead of a callback URL, and I assume that instead of seeing I authorized already it's just taking me back to the authorize screen. What have I done wrong? Here is my code:
`$oauth2 = new OAuth2("882622674352873522", "[SECRET]", "https://netrx.piercegearhart.com/account/discord/redirect");

if ($oauth2->isRedirected() === false) {
    $oauth2->startRedirection(['identify', 'connections', 'email', 'guilds']);
} else {
    $ok = $oauth2->loadToken();
    if ($ok !== true) {
        $oauth2->startRedirection(['identify', 'connections', 'email', 'guilds']);
    } else {
        $answer = $oauth2->getUserInformation();
        if (array_key_exists("code", $answer)) {
            exit("An error occured: " . $answer["message"]);
        } else {
            echo "Welcome " . $answer["username"] . "#" . $answer["discriminator"];
        }

        echo '<br/><br/>';
        $answer = $oauth2->getConnectionsInformation();
        if (array_key_exists("code", $answer)) {
            exit("An error occured: " . $answer["message"]);
        } else {
            foreach ($answer as $a) {
                echo $a["type"] . ': ' . $a["name"] . '<br/>';
            }
        }
    }
}`

Can't login via sample index.php

Hey,
I am using PHP Slim and I embedded your sample index.php.
However it seems like that the authentification doesn't work.
I used an echo "hi"; and print_r($oauth2); to print where the page is stuck and it seems like the page never gets to the user informmation retrievement.

// ...
  if ($oauth2->isRedirected() === false) { // Did the client already logged in ?
        // The parameters can be a combination of the following: connections, email, identity or guilds
        // More information about it here: https://discordapp.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes
        // The others parameters are not available with this library
        $oauth2->startRedirection(['identify', 'guilds']);
        print_r($oauth2);
        echo "hi";
    } else {
// ...

Result is:

Xwilarg\Discord\OAuth2 Object ( [_clientId:Xwilarg\Discord\OAuth2:private] => xxxxxxxxxxxxxxxxxx [_secret:Xwilarg\Discord\OAuth2:private] => xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx [_redirectUrl:Xwilarg\Discord\OAuth2:private] => http://localhost:8090/ [_accessToken:Xwilarg\Discord\OAuth2:private] => ) hi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.