wohali / oauth2-discord-new

New Discord Provider for the OAuth 2.0 Client
MIT License
118 stars 22 forks source link

{"error":"invalid_client"} thrown from $provider->getAccessToken #48

Closed ianring closed 1 year ago

ianring commented 1 year ago

notsomuch an "issue" because I doubt the oauth code is buggy, but I'm getting this error so -- what am I doing wrong?

I've plugged in the credentials, I'm using the code in the README, and the $_GET['code'] is there and looks plausible. The error is happening on this command:

$token = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code']
]);

it throws a Wohali\OAuth2\Client\Provider\Exception\DiscordIdentityProviderException

the message is {"error":"invalid_client"} I googled this. There are lots of pages describing this error message but none seemed relevant to this instance. Any ideas?

wohali commented 1 year ago

Usually invalid_client means the secret is invalid. Double-check your code, and that you have the latest release of this library (v1.2.1)? The base authorization URL has recently changed, in addition with changes relating to the deprecation of the old v6 Discord API.

ianring commented 1 year ago

well I'll be $#@. That's what it was -- I went to discord, reset the secret, pasted it into my app, and now it works.

Thanks for the prompt response! And the working code! And btw your profile says you're from Toronto -- I'm just down the 401 in Waterloo. Cheers!