Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Axios GET Req with Basic Auth

const res = await axios.get('https://httpbin.org/basic-auth/foo/bar', {
  // Axios looks for the `auth` option, and, if it is set, formats a
  // basic auth header for you automatically.
  auth: {
    username: 'foo',
    password: 'bar'
  }
});
res.status; // 200
Source by masteringjs.io #
 
PREVIOUS NEXT
Tagged: #Axios #GET #Req #Basic #Auth
ADD COMMENT
Topic
Name
8+9 =