Horje
Axios GET Req with Basic Auth and Error Code Example
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
Axios GET Req with Basic Auth and Error
const err = await axios.
  get('https://httpbin.org/basic-auth/foo/bar', {
    auth: {
      username: 'foo',
      password: 'baz' // Bad password
    }
  }).
  catch(err => err);
err.message; // "Request failed with status code 401"
err.response.status; // 401 "Unauthorized"




Javascript

Related
forget mot de passe api nodejs mongodb example Code Example forget mot de passe api nodejs mongodb example Code Example
javascript find smallest difference between angles Code Example javascript find smallest difference between angles Code Example
JS Wrap Function Code Example JS Wrap Function Code Example
react social login buttons Code Example react social login buttons Code Example
bindbidirectional vue js Code Example bindbidirectional vue js Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8