-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting back only code but no access token, or refresh token. #96
Comments
I realized i left out "EDIT" The previous issue is now gone. But after logging in, I get the discord authorization page, and on login my url is appended with ?{code} but I'm still not receiving an access token? Whole snippet of code ->
|
@javierohern I was having a similar issue: It's coming from this piece:
And more specifically, It appears that there is something going wrong where the discord.get_access_token(code) is not returning a value, which is leaving "token" as None. If you look at Discord's OAuth2 documentation, you can see how to call for an access token yourself. Here is what I ended up doing to get around the packaged DiscordOAuthClient.get_access_token returning None:
This takes the code that returns with the auth, then uses it to request, and receive, a token. Note that tokenData is still in JSON format, you'll need to parse it as needed. tokenData looks like this:
|
I could not reproduce this issue with neither v0.2.4 nor v0.2.5. It would be helpful if you could try to reproduce the following steps:
git clone https://github.com/Tert0/fastapi-discord.git
cd fastapi-discord
git checkout v0.2.5
pip3 install fastapi-discord==0.2.5 uvicorn
uvicorn examples.basic
curl http://localhost:8000/login Or open The browsers should display the access and refresh token in JSON. {"access_token":"redacted","refresh_token":"redacted"} I hope it works for you, at least it works for me. (I have tested it with a docker container python (Debian-based)) |
Title.
Discord developer portal knows about my redirect_uri which is http://localhost:8000/callback
The text was updated successfully, but these errors were encountered: