Skip to content

Discord API OAuth2 token url returns 401 #910

@mttv

Description

@mttv

Hi! I'm trying to add discord auth to my reactjs app. So the problem is that I cant receive user auth token from https://discordapp.com/api/oauth2/token because it send me 401 code, meaning that it needs Authorization header. But there is no mentions for this header in docs and I can't understand how I need to pass it if Im asking for auth token.

Code:

let data = {
     client_id: client_id,
     client_secret: client_secret,
     grant_type: "authorization_code",
     code: token,
     redirect_uri: "https://mttvapp.com/",
     scope: "identify"
}
data = $.param(data)
discord.post("/oauth2/token", {data}, {
       headers: {
             'Content-Type': 'application/x-www-form-urlencoded'
       }
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions