Home > Software engineering >  POST axios request blocked by fluidpay api
POST axios request blocked by fluidpay api

Time:11-14

I'm trying to send a post request to this end point https://sandbox.fluidpay.com/api/token-auth and I'm getting this error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://sandbox.fluidpay.com/api/token-auth. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 405

When I send the request from Postman, it works. But when I try to send it using axios, I get the above error.

This is how I'm making the request using axios:

const request = await axios({method: "post", url: "https://sandbox.fluidpay.com/api/token-auth", data: {username: username, password: password}, withCredentials: false});

Shouldn't public API's be accessible to all domains?

CodePudding user response:

EDIT

It looks CORS is disabled server side. If you don't control the server, you can't do much with a browser. The only way to solve the problem is using an API owned by yourself to proxy the request.

Read more here

  • Related