To ask for basic authentication in an HTML page, you can use the following code snippet:

<form method="post" action="">
  <label for="username">Username:</label>
  <input type="text" id="username" name="username"><br><br>
  <label for="password">Password:</label>
  <input type="password" id="password" name="password"><br><br>
  <button type="submit">Login</button>
</form>

This form will prompt the user to enter their username and password, which can then be sent to the server using the HTTP POST method. The server can then check the credentials and grant access to the protected resource if they are correct. Note that this form alone does not provide any actual security - it is up to the server to implement the authentication mechanism and protect the resource appropriately.

Ask for basic auth in html page

原文地址: https://www.cveoy.top/t/topic/bezA 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录