Can't get retrun response from /api/v2/users/<user_id>.json API
Publicado 18 de nov. de 2022
From my react application, I'm calling below function i.e. javascript function
export const getUserName=async(author_id,login,password)=>{
return await axios.get(baseURL+`/api/v2/users/${author_id}.json`, {
headers: {'Access-Control-Allow-Origin': '*'}
auth: {username: login,password: password}})
.then(response=>console.log(response))
}
After hitting above method, getting below error
Access to XMLHttpRequest at '<baseURL>/api/v2/users/<id>.json'
from origin 'http://localhost:3000' has been blocked by CORS policy:
Request header field access-control-allow-origin is not allowed by
Access-Control-Allow-Headers in preflight response.
If I hit same url in postman, its working fine where as its not working from react-application.
Let me know if you required any further details.
0
7
0 comentários
Entrar para deixar um comentário.