I'm using superagent v3.8.3 I got Access-Control-Allow-Origin
CORS error.
import request from 'superagent'
request(
APIS.IAMPORT.GET_TOKEN.method,
APIS.IAMPORT.GET_TOKEN.path()
)
.withCredentials()
.send({
imp_key: config.iamport.apiKey,
imp_secret: config.iamport.secretKey
})
.end((err, res) => {
if (err) reject(err)
else resolve(res.body)
})
I tried to use .withCredentials()
, but it doesn't work.
I got this error message from api.
apply?id=21:1 Access to XMLHttpRequest at 'https://api.iamport.kr/users/getToken' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
However, I can get result when I'm using postman.
I think remove OPTION http method is gonna work. but I'm not sure how can I solve this problem.
How can solve this? thanks.