在将应用程序将后端部署到多个AWS EC2实例时,使用Laravel Sanctum对水疗中心的用户进行身份验证会引起问题?

发布于 2025-01-30 23:58:37 字数 504 浏览 3 评论 0原文

Laravel Sanctum 是用于水疗中心(单页应用程序),移动应用程序和简单令牌的API的身份验证系统。

在为水疗中心身份验证用户时,Sanctum不会使用任何形式的令牌。相反,Sanctum使用Laravel的基于Cookie的会话身份验证服务。

我有一个由前端(SPA)和后端(Laravel API)组成的应用程序。该后端部署到多个AWS EC2实例中,并使用负载平衡器来处理这些EC2实例中传入流量的分布。

现在,如果我使用Laravel Sanctum对水疗中心的用户进行身份验证,这不是因为我将后端部署到多个AWS EC2实例而引起问题吗?

我的意思是,如果用户通过EC2实例编号1进行身份验证,例如,当他向后端发送另一个请求时,该请求由LOAD BALANCER发送到EC2实例编号2,例如,此实例将如何知道用户已经对用户进行身份验证,而不是在他登录时为他发出会话的那些?

Laravel Sanctum is an authentication system for SPAs (single page applications), mobile applications, and simple token-based APIs.

When authenticating users for SPAs, Sanctum does not use tokens of any kind. Instead, Sanctum uses Laravel's built-in cookie-based session authentication services.

I have an application that consists of a frontend (SPA) and a backend (Laravel API). That backend is deployed to multiple AWS EC2 instances and uses a load balancer to handle distributing the incoming traffic across these EC2 instances.

Now, if I use Laravel Sanctum to authenticate the users of a SPA, isn't that going to cause an issue because I deploy the backend to multiple AWS EC2 instances?

I mean, if the user has been authenticated through the EC2 instance number 1 for example, when he sends another request to the backend, and that request is sent by the load balancer to the EC2 instance number 2 for example, how this instance will know that the user is authenticated already while it is not the one that issued a session for him when he logged-in?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文