K
K
Kirill Gavrilov2019-06-24 12:43:51
JSON Web Token
Kirill Gavrilov, 2019-06-24 12:43:51

Why is axios get request not working?

Hello everyone, I've been working on a problem for two days now.
The bottom line is, I send a request from the Restlet Client to the server and get a 200 response, everything works fine. But I'm trying to send an axios request through REACT, writes

Access to XMLHttpRequest at .....
Uncaught (in promise) Error: Network Error
    at createError (createError.js:17)
    at XMLHttpRequest.handleError (xhr.js:80)

Here is the react code:
validation_token() {       

        var urlValidation = 'localhost:8000/api/GetTokenData';
        var token = this.getToken();

        var headers = { 
             'Token': token
        };

        axios.get(urlValidation, {  headers  })
            .then(Response => Response.json())
            .then(json => {console.log(json)});
    }

I just want to output to the console what comes there.
PS: The header is Header set Access-Control-Allow-Origin "*" on the server - I wrote it directly in htaccess. If not, then the restlet client would not work.

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