0

On postman, I can access endpoints by adding the headers:

Key: Value ( I will insert fake figures for example)

x-mash-auth-token: gdjsjaosh-hkds-dhjsk-hjjdbahsj

I am building a react app that allows user to search endpoints, how can I include this header in my code to grant user access on UI?

1 Answer 1

1
            axios({
                url: "API URL",
                method: "GET",
                data: {name: "abc"},
                contentType: 'application/json',
                headers: {
                    "Access-Control-Allow-Origin": "*",
                    'Accept': 'application/json',
                    'Content-Type': 'application/json',
                    'Pragma': 'no-cache',
                    'Authorization': 'Bearer gdjsjaosh-hkds-dhjsk-hjjdbahsj',
                    'Access-Control-Expose-Headers': "jwt_token"
                },
                responseType: 'json'
            })
            .then(function (response) {
                successCallback(response);
            })
            .catch(function (error) {
                errorCallback(error);
            })
    
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.