How add headers after basic auth, can't login, site doesn't loads

121 Views Asked by At

I used selenium 4, python, chrome. I can't login in to site which requires basic auth

Hello!

I can't login if i use

https://log:[email protected]

then site doesn't rendering and doesn't loads fully

if i trie to use following:

authorization = base64.b64encode("log:paws".encode("ascii")).decode("ascii")
                auth_dict = {'Authorization': f"Basic {authorization}"}
                params = ({"headers": network.Headers(auth_dict)})

                driver.execute_cdp_cmd('Network.enable', {})
                driver.execute_cdp_cmd('Network.setExtraHTTPHeaders', params)
                driver.get(https://new.dev.tech)

then: site loads and i get cookie with token. few links like https://api.dev.tech don't load and have Status Code: 401 Unauthorized All links like https://new.dev.tech.... has token in headers - it's correct but links like https://api.dev.tech has empty header, without Authorization Bearer....

I understand, i should add Authorization Bearer... to header. What i should do?

0

There are 0 best solutions below