【发布时间】:2020-06-23 06:38:09
【问题描述】:
我的 laravel 应用中有一些 API 端点。
它们在我的大多数设备(手机和平板电脑)上都能正常工作。
来自本地主机的 curl 也可以正常工作。
但是一部手机不行。在我得到的日志中:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Unauthorized</title>
</head><body>
<h1>Unauthorized</h1>
<p>This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
<hr>
<address>Apache Server at example.com Port 443</address>
</body></html>
我不知道问题出在哪里。
API 端点是公开的。它们适用于 curl 和所有其他设备。
我尝试更改 WLAN,但如果所有设备都使用相同的 WLAN,那一部手机仍然无法工作。 这可能是手机上的安全设置?但我什么也没找到。
我很担心,因为如果我发布项目并且许多用户将面临这个问题,我不知道去哪里寻找或做什么。这甚至是一个 laravel 问题吗?
我使用 laravel 5.8,API 路由在 api.php。
【问题讨论】: