Pass key and value in Axios request NodeJS

import axios from 'axios';

export default axios.create(
        {
            baseURL: 'https://netsocial-838923.uc.r.appspot.com/api/v1/products',
            headers: {
                'x-auth-token': 'Bearer eyJhbGciOdjfdkfiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1ZmEwMWMzZmM4YjIwfdkjdfjjBjZDQyMmJkNzUdkfjjfdsfjdiLCJpYXQiOjE2MDQ0MTAwMDZ9.xZU6RZgj5D8u1cqlSYv5mkdHn8-SnW0KwFAgVtsJUQw',
            }
        }
);

Also, I can see there is not Bearer used. If not remove from token. or else keep the bearer as it is.

You need to change header name to the name which API is looking for.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top