BASIC 認証

BASIC 認証のテストに使えるサイト

BASIC 認証のテストに使えるサイトを紹介する。

BASIC 認証のリクエスト方法

BASIC 認証付きリクエストのコードサンプル

$ curl -u 'username:password' 'https://example.com/'
$ curl -H "Authorization: Basic $(echo 'username:password' | base64)" 'https://example.com/'
$ curl 'https://username:password@example.com/'
$ wget --http-user=username --http-password=password 'https://example.com/'
$ wget --header="Authorization: Basic $(echo 'username:password' | base64)" 'https://example.com/'
$ wget 'https://username:password@example.com/'
const response = await window.fetch('https://example.com/', {
  headers: {
    'Authorization': `Basic ${window.btoa('username:password')}`
  }
});
const result = await response.json();
const response = await axios.get('https://example.com/', {
  auth: {
    username: 'username',
    password: 'password'
  }
});
const result = response.data;