How to obtain the access_token

Like the topic, I want to get access_token and use it to obtain long live token through websocket, but I have no idea about the step of this document “Authentication API ”, it seems that we can obtain the access_token through the method below

http://your-instance.com/auth/authorize?
    client_id=https%3A%2F%2Fhass-auth-demo.glitch.me&
    redirect_uri=https%3A%2F%2Fhass-auth-demo.glitch.me%2F%3Fauth_callback%3D1

But I have no idea that it is being implemented via requests of python or something else. So I try it like this

headers = {
            "content-type": "application/x-www-form-urlencoded",
            }   
payload = {
            "client_id": "http%3A%2F%2F192.168.30.130%3A8123%2F&",
            "redirect_uri": "http%3A%2F%2F192.168.30.130%3A8123%2Fprofile%3Fauth_callback%3D1&",
            'response_type': 'code',
            "state": "http%3A%2F%2Fhassio.local%3A8123"
            }
url = "http://192.168.30.130:8123/auth/authorize?"
ret = requests.post(url, json=payload, headers=headers)
print(ret)

OR

headers = {
            "content-type": "application/x-www-form-urlencoded",
            }   
url = "http://192.168.30.130:8123/auth/authorize?response_type=code&redirect_uri=http%3A%2F%2F192.168.30.130%3A8123%2F%3Fauth_callback%3D1&client_id=http%3A%2F%2F192.168.30.130%3A8123%2F&state=eyJoYXNzVXJsIjoiaHR0cDovLzE5Mi4xNjguMzAuMTMwOjgxMjMiLCJjbGllbnRJZCI6Imh0dHA6Ly8xOTIuMTY4LjMwLjEzMDo4MTIzLyJ9"
ret = requests.post(url, headers=headers)
print(ret.text)

It will return <Response [405]>, It can’t request this URL by using POST, if change the method to GET, then it just returns some unuseful information about the URL. Can someone provide the simple instance?

Any help would be appreciated!