Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Home
Jobs
Ideas
Members
Mentorship
User Groups
Downloads
Platforms
OutSystems.com
My Platform
Community
Resources
Support
Search in OutSystems
Log in
Sign Up
Community
›
Forge
›
Assets list
›
DiscordOAuth2
DiscordOAuth2
Stable version
1.0.0
(Compatible with
OutSystems 11
)
Uploaded
on
13 December 2022
by
0.0
(0 ratings)
Overview
Reviews
Versions
Documentation
Support
DiscordOAuth2
Documentation
1.0.0
Draft
https://discord.com/developers/docs/intro
1
. Get your Client Id and Client Secret
The first step in implementing OAuth2 is
registering a developer application
and retrieving your client ID and client secret.
After you create your application with Discord, make sure that you save your client_id and client_secret in the site properties.
2. Retrieve the Authorization Code Grant
The authorization code grant is what most developers will recognize as "standard OAuth2" and involves retrieving an access code and exchanging it for a user's access token.
It allows the authorization server to act as an intermediary between the client and the resource owner, so the resource owner's credentials are never shared directly with the client.
The URL will look something like this:
https://discord.com/oauth2/authorize?response_type=code&client_id={client_id}&scope={scope}&redirect_uri={redirect_uri}
Here the client_id is your application's client_id which we got in the previous step. The scope is what permissions you request from the user for more scopes visit
here
. For clients and guilds details, we are using the "identify%20guilds".
The redirect_uri, is where you will be redirected after granting authorization,
you have to add the redirect url in your application page
and encode the URL, here we are using "EncodeUrl("https://gdclopes.outsystemscloud.com/DiscordDemo/Landing")"
3. Access Token Exchange
The authorization code is now exchanged for the user's access token by making a POST request to the token URL with the following parameters:
client_id - your application's client id
client_secret - your application's client secret
grant_type - must be set to "authorization_code"
code - the code from the querystring
redirect_uri - the redirect_uri associated with this authorization, usually from your authorization URL
You can also pass your client_id and client_secret as basic authentication with client_id as the username and client_secret as the password.
Loading
Loading...