![]() ![]() The function will then return an AccessToken object which holds information such as the refresh_token and the access_token. This is the code that you pass into the exchange_code function. In Django, you would access it like so: ("code"). After getting redirected, the URL on your end will be returned with the code URL parameter, which looks like so. After a user logins in using your URL, they will be redirected to the redirect_uri that you provided on the Developer Portal. To get an access token, you first need the code given to you by the OAuth2 login url that you created on the Discord Developer Portal. To access a user's info, you need what's called an Access Token. To initialise an OAuth2 Client, simply follow the example below: from discord_web.oauth2 import Oauth2Client client = Oauth2Client ( client_id, "client_secret", "redirect_uri", ) Generating an Access Token Once you do that, click on the OAuth2 tab and follow the example below: Here we list both ways of installing the library (the stable version and the development version) pip install discord.webįirst of all, you need to create an application on the Discord Developer Portal. Installing the discord.web library is a breeze. If you wish, you can install the speedups package for aiohttp, which allows aiohttp to run requests much faster. Keep in mind that all of these (with the exception of aiohttp) are installed when installing discord.web Here's a list of prerequisites that you will need for the discord-web library to work. Here, we explain how you can get started with the discord-web library. We handle the requests for you, returning easy to manage Python Objects such as the Oauth2Member object and the Oauth2Guild. Creating these requests yourself can be time-consuming! Here's where Discord-Web comes into play. Well, a good example would be a Login backend on your bot's website to allow for some advanced dashboard creation. ![]() If you're new the realm of developing for discord, you may not know what the Oauth2 api may be used for. An asynchronous wrapper for the Discord Oauth2 APIÄiscord-Web is an easy way to interface with the Discord Oauth api. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |