fastapi-discord
fastapi-discord copied to clipboard
Help please
I dont understand how to work with "Depends" Just help, how to get user info using access token? Because "Example" code dont work, it writes "Unuuthenticated" error when i do isAuthenticated, get_user and get_guilds functions maybe fastapi dont save my user in cache...
The easiest way to test the example is with the intrgrated FastAPI docs at http://127.0.0.1:8000
- Get the URL from the
/loginEndpoint - Use the URL from step one: Open it in a new Browser Tab and click on authorize
- You should get redirected to your callback url and see your tokens like this:
- Use the "Authorize" Button of the FastAPI Docs and input your access_token
- The
/authenticatedEndpoint should return true - You can now use the other endpoints
If you develop a application for this you have to handle this in code. You should provide the user with a Button opening the Discord URL. When the callback is called you should save the tokens on the client and provide them on every request in the Authorization header.