P粉8514014752023-09-01 10:10:38
Client code cannot perform this operation.
The closest way is to have the server respond to the request with a 401 Unauthorized
status and a WWW-Authenticate: Basic
header, which causes the browser to prompt the user for input using its native UI Credentials, and after the user enters the credentials, repeat the request using the format for Basic Authentication and add Authorization
.
As Phil mentioned in the comments, it sounds like the URL you want to request is indeed not designed for direct browser navigation.
Rather than trying to solve this problem, you may be better off changing the authentication system to something else (such as a cookie set in response to submission of a traditional login form)