Answers for "axios fill in authorization bearer"

1

autherization token in axios

const api = 'your api'; 
const token = JSON.parse(sessionStorage.getItem('data'));
const token = user.data.id; /*take only token and save in token variable*/
axios.get(api , { headers: {"Authorization" : `Bearer ${token}`} })
.then(res => {
console.log(res.data);
.catch((error) => {
  console.log(error)
});
Posted by: Guest on February-29-2020

Code answers related to "axios fill in authorization bearer"

Browse Popular Code Answers by Language