Go REST
R

Getting 403 using axios

Rafael Heros de Almeida over 3 years ago 6551 views 4 replies

Hello i'm getting error 403 forbbiten acces when using axios.get on https://gorest.co.in/public/v2/users

this is my code:

try{
let users = await axios.get('https://gorest.co.in/public/v2/users?access-token=MY-TOKEN-HERE)

console.log(users)

} catch(err) {
console.log(err)
}

4 replies
Z
zeevy over 3 years ago

Can you please check now and let me know

R
Rafael Heros de Almeida over 3 years ago

I discovered the issue, it's a https problem. When we run the development build using localhost the API gets blocked by CORS because localhost runs on http and it's not the secure protocol.

I think if you run anything that enables requests by http access would be incredible so we don't have to install SSL on to run dev builds or deploy the development version just to check if the API call is working

Z
zeevy over 3 years ago

https is mandatory, I can't disable that.

I have seen some logs blocking the user agent axios in backend, adjusted those rules

M
Misterios Person over 3 years ago

let users = await axios.get('https://gorest.co.in/public/v2/users').set('Authorization', 'Bearer MY-TOKEN-HERE')

Have you tried it this way?

Your reply

Markdown supported