-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Description
Description
When following the client credential flow, only select scopes are permitted for use (identify and applications.commands.update). If another scope -- such as email is specified, an error is thrown. Is this expected behavior?
The documentation states:
You can specify scopes with the
scopeparameter, which is a list of OAuth2 scopes separated by spaces
Steps to Reproduce
- Copy the following code snippet
var id = "";
var secret = "";
var headers = new Headers();
headers.append("Content-Type", "application/x-www-form-urlencoded");
var body = new URLSearchParams();
body.append("grant_type", "client_credentials");
body.append("scope", "identify email");
body.append("client_id", id);
body.append("client_secret", secret);
var requestOptions = {
method: 'POST',
headers,
body,
redirect: 'follow'
};
fetch("https://discord.com/api/oauth2/token", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));- Edit the
idandsecretvalues to a client id and client secret respectively - Run the code sample in the Developer Tools console
- Observe
Expected Behavior
A (bearer) token is returned with access to the authorized user's email.
Current Behavior
The following error is thrown:
{
"error":"invalid_scope",
"error_description":"The requested scope is invalid, unknown, or malformed."
}advaith1