GitHub API 在我尝试登录时返回的消息需要身份验证

GitHub API returning message requires authentication while I try to login

const fetchUser =  async () =>{
    let username : any = (document.getElementById('username') as HTMLInputElement).value;
    let password : any = (document.getElementById('password') as HTMLInputElement).value; 
    const profile = await fetch("https://api.github.com/user", {
        headers:{
            'Authorization': 'Basic ' + window.btoa(username + ":" + password)
        }
    })
   const profileResponse = await profile.json()
    console.log(profileResponse)
}
const handleSubmit =(e:any) =>{
    e.preventDefault()
    fetchUser()
}

我尝试使用 GitHub API 使用 GitHub 凭据登录,但 returns 需要身份验证

Github.com 已停止使用 usernamepassword 对 API 进行密码验证。

Reference