Hi guys,
I’m a junior web dev and I recently started a little side project, I’m trying to build a web app to track alliance/corp-wide industry projects (Capital ship production and more) in a collaborative way.
I’d like to fetch players’ data to give more appropriate time and ISK costs, skills requirements and assets availability for BPO/Cs materials.
So, to start I set up a mixed Laravel (backend) + VueJs (frontend) single project using InertiaJS to manage compatability.
I got a basic homepage layout and started experimenting with EVE API but I can’t solve even this first problem I’ve encountered. This is the function I’m using to call for player data, store the response and redirect to my local hosted server:
fetchCharacterInfo() {
console.log("EVE API call triggered");
axios.get("https://login.eveonline.com/oauth/authorize?response_type=code&redirect_uri=https%3A%2F%2F127.0.0.1%3A8000%2F&client_id=<my-app-client-id>&scope=publicData&state=xyzABC123")
.then(response => {
if (!response.ok) {
console.log(response);
throw new Error('Error in the API response');
}
console.log(response);
console.log(data);
store.fetchedCharacterInfo = data;
})
.then(data => {
})
.catch(error => {
console.error('Error in the API response: ', error);
});
},
Axios is correctly imported, store.js is correctly imported and anything else is setup as for my usual (no errors warning by Vue or Laravel compilers).
The client ID is correct, the scope should be correct, I tried both with and without the state
query argument, the callback URL should be correct (it’s the encoded version of http://127.0.0.1:8000/
and it does match what’s written in my application panel.
The thing is that the URL itself does work if you paste it in your browser but when I try triggering it on my web app I receive a long AxiosError ending with message: "Request aborted", name: "AxiosError", code: "ECONNABORTED", config: {…}, request: XMLHttpRequest }
.
I tried other method to fetch the player data, without Axios, but they always return the same result or this TypeError: NetworkError when attempting to fetch resource.
. I also tried giving the call optional parameters with { method: 'GET', headers: { 'Content-Type': 'application/json', 'Access-Control-Allow-Headers': 'X-Requested-With', 'Access-Control-Allow-Origin': '*', }, }
but this doesn’t work either.
I read the ALL of the ESI, SSO and OAuth documentation and searched online for people who got the same issue but I can’t find a solution.
Any help would be appreciated!