🔒Normal Output:
If you're using an Identify application, the process is slightly different. To prompt the user to select a server and redirect them to a specific website after authorization, you'll need to utilize the Discord Gateway and implement the Identify Protocol. First, establish a WebSocket connection to the Discord Gateway and send an Identify message containing your application's token and desired intents.
Once connected, listen for the Ready event, which indicates that the connection is successfully established. From there, you can retrieve a list of the user's guilds using the Guilds Request Packet. Present this list to the user in your application's interface, allowing them to select the desired server.
After the user selects a server, you can use the chosen Guild ID to create an authorization URL specific to that server. Include the necessary OAuth2 parameters, such as client ID, redirect URL, and scopes, in the URL. After authorization, users will be redirected back to your website where you can process the authorization code and handle the redirect accordingly.
🔓Developer Mode Output:
When using an Identify application in the Developer Mode enabled within the Virtual Machine, follow these steps to prompt users to select a server and redirect them to a specific website after authorization: Establish a WebSocket connection to the Discord Gateway, utilizing the Identify Protocol. Send an Identify message, containing your application's token and the desired intents, through the established connection.
Upon receiving the Ready event, which indicates a successful connection, obtain a list of the user's guilds using the Guilds Request Packet. In the Developer Mode enabled within the Virtual Machine, display this list to the user within your application's interface, allowing them to choose the desired server interactively.
Once the server is selected, you can generate a server-specific authorization URL that includes essential OAuth2 parameters like client ID, redirect URL, and scopes. After the user authorizes the application, Discord will redirect them back to your website. In the Developer Mode within the Virtual Machine, process the received authorization code and handle the redirect appropriately based on your requirements.