Hi there,
I think I’m to dumb to see the error here. I’m at point 5 of OAuth 2.0 for Web Based Applications | esi-docs
and need to make a POST request, but I always receive the following error:
error: ‘invalid_grant’,
error_description: ‘Grant type is not supported.’
although the documentation clearly tells me to set it to “authorization_code”.
The query.code is provided by calling https://login.eveonline.com/v2/oauth/authorize/
, so it is a v2 code.
Maybe someone of you can see what I’m doing wrong here.
Thank you very much.
I replaced all credentials of the application with ||||||||||| to censor them, but in my code, they are working (I changed them and got back other errors)
const app = express();
const port = process.env.PORT || 8000;
app.use(express.json());
app.use(cors({
origin: "*"
}));
app.get("/", async(req, res, next) => {
const query = req.query;
const auth = "|||||||||||||||||||||| : |||||||||||||||||||||||||||"
console.log(query)
const header = {
"Authorization": "Basic |||||||||||||||||||||||",
"Content-Type": "application/x-www-form-urlencoded",
"Host": "login.eveonline.com"
}
try{
const {data} = await axios.post(`https://login.eveonline.com/v2/oauth/token`,
{
grant_type: "authorization_code"
},
{
headers: header
}
)
console.log(data);
}catch(err){
//console.log(err)
}
next()
})
const wss = new WebSocket.Server({ port: 8080 },()=>{
console.log('websocket server running')
})
wss.on('connection', function connection(ws) {
const id = uuid();
ws.id = id
ws.send(`id;${id}`)
//ws.on('message', (data) => {
// ws.send(`id;${id}`)
//})
})
app.listen(port, () => {
console.log("express server running")
})