URLの書式(username, password, etc...)
URLのユーザ名とパスワードの書き方
http://username:password@example.com/
http://username@example.com/
http://password@example.com/
※ユーザー名は、ログインサイトでユーザー名入力をスキップできるため、よく使う
※パスワードは、URLに記載すると平文のまま送信される上、ログに残るため、決して利用してはならない
その他のURL
var url = new URL('https://username:password@example.com:80/path/file?param1=data1¶m2=data2#hash');
console.log(`${url.href}`);
//https://username:password@example.com:80/path/file?param1=data1¶m2=data2#hash
console.log(`${url.protocol}//${url.username}:${url.password}@${url.hostname}:${url.port}${url.pathname}${url.search}${url.hash}`);
//https://username:password@example.com:80/path/file?param1=data1¶m2=data2#hash
console.log(`${url.protocol}//${url.username}:${url.password}@${url.host}${url.pathname}${url.search}${url.hash}`);
//https://username:password@example.com:80/path/file?param1=data1¶m2=data2#hash
console.log(`${url.origin}${url.pathname}${url.search}${url.hash}`);
//https://example.com:80/path/file?param1=data1¶m2=data2#hash