Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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)
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: onclick css display jquery 
Javascript :: js create element 
Javascript :: javascript push item to beginning of array 
Javascript :: get current domain javascript 
Javascript :: how to get iso date with moment 
Javascript :: To install the latest version of React: 
Javascript :: javacript open url in new tab 
Javascript :: jquery count elements 
Javascript :: javascript string get last two character 
Javascript :: how to view sync storage in chrome 
Javascript :: jquery slidetoggle 
Javascript :: install node js lts ubuntu 18.04 
Javascript :: a JavaScript function to multiply a set of numbers 
Javascript :: jQuery - Filters 
Javascript :: data-dismiss= modal in jquery 
Javascript :: string to int javascript 
Javascript :: afficher un div qui etait cache en javascript 
Javascript :: jquery set style background image 
Javascript :: jquery validate if field exists 
Javascript :: insta icon in next js 
Javascript :: js string pop last character 
Javascript :: math random 0 to 100 
Javascript :: js escape url parameter 
Javascript :: jquery scroll left animation 
Javascript :: input type number react native 
Javascript :: axios file upload 
Javascript :: adonis js sort by 
Javascript :: node js send file from root dir 
Javascript :: regex valid jwt 
Javascript :: javascript initiate array all zero 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =