Answers for "how to authenticate token in react using axios"

1

how to authenticate token in react using axios

const api = `your api here`
axios.get(api, { headers: {"Authorization" : `Bearer ${token}`} })
        .then(res => {
            console.log(res.data);
        this.setState({
            items: res.data,  /*set response data in items array*/
            isLoaded : true,
            redirectToReferrer: false
        })
Posted by: Guest on May-20-2020

Code answers related to "how to authenticate token in react using axios"

Code answers related to "Javascript"

Browse Popular Code Answers by Language