T
T
tamerlanlarsanov2021-09-21 18:00:20
JSON Web Token
tamerlanlarsanov, 2021-09-21 18:00:20

What exactly is the token I get from Discord with Oauth2?

I made a dashboard in which I get the user's access_token during his authorization in the dash through the discord. After that, the application should connect his account via the wss protocol to the bot, but the problem is that the discord refuses when I try to feed him an access_token, namely 4004 - this is a data error. At the same time, I can make the simplest api requests using the https protocol with this token, and the token is accepted, I get 200s. I don’t understand what exactly discord doesn’t like, and what kind of token does it then ask for in the documentation? An excerpt from the documentation below:

{
  "op": 2,
  "d": {
    "token": "my_token",
    "intents": 513,
    "properties": {
      "$os": "linux",
      "$browser": "my_library",
      "$device": "my_library"
    }
  }
}


and here is where I get the tokens after passing 0auth2:

{
  "access_token": "6qrZcUqja7812RVdnEKjpzOL4CvHBFG",
  "token_type": "Bearer",
  "expires_in": 604800,
  "refresh_token": "D43f5y0ahjqew82jZ4NViEr2YafMKhue",
  "scope": "identify"
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question