Answers for "axios basic auth"

7

axios bearer token

{
    headers: {
      'Authorization': 'Bearer ' + validToken()
    }
 }
Posted by: Guest on December-20-2020
0

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
Posted by: Guest on May-11-2021
0

Axios Req with Auth Token

// Send a GET request with the authorization header set to
// the string 'my secret token'
const res = await axios.get('https://httpbin.org/get', {
  headers: {
    'Authorization': 'my secret token'
  }
});
Posted by: Guest on July-11-2020
0

axios basic auth generate

await axios.post(session_url, {}, {
  auth: {
    username: uname,
    password: pass
  }
});
Posted by: Guest on May-18-2021

Browse Popular Code Answers by Language