我需要向https://authserver.mojang.com/authenticate发送请求
并获得响应
"accessToken": "valid accessToken",
"clientToken": "client identifier",
"selectedProfile": {
"id": "profile identifier",
"name": "player name"
},
"requestUser": true
}```
but I dont know how to ask the server for the out put.
What I need to input is
```{"agent": {"name": "Minecraft", "version": 1},
"username": "-email here-",
"password": "-pass here-"}
That is the data needed to get the token but I can't seem to get the code to ask the server for the token data and than receive it and put it into a JSON.
const postData = async _ => {
const response = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"agent": { "name": "Minecraft", "version": 1 },
"username": "-email here-",
"password": "-pass here-"
})
})
console.log(response)
}