Reputation: 11
I am writing axios post function to search for vehicle details using chassis number and other details .. Postman shows no error and works very well but it shows 403 error when trying to run the code
export const searchByChassis = (chassis: string, seq?: string, customNo?: string) => async dispatch => { return await axios( { method: 'post', url: '/api/sticker/details', headers: { 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8', 'x-clientId': xClientId, "Access-Control-Allow-Origin":"*" }, data: { chassis: chassis, seq: seq ? seq : "NULL", customNo: customNo ? customNo : "NULL" } }) .then(response => {
return JSON.stringify(response);
}).catch((error) => console.log(error));
Upvotes: 1
Views: 158
Reputation: 36
403 error code might be a result of access permission. Have you checked if the authentication was successful? Are you missing any API keys that are required? May be your passing the keys correctly from Postman and missing them in the actual API calls from the code.
Upvotes: -1