简体   繁体   English

如何根据 Laravel 中 rest API 的响应对用户进行身份验证?

[英]How to authenticate user from the respons of rest API in Laravel?

I am creating a laravel application using two laravel applications.我正在使用两个 laravel 应用程序创建一个 laravel 应用程序。 The first laravel application will be used for handling API requests, the second one will be used for making a request to the first laravel application.第一个 laravel 应用程序将用于处理 API 请求,第二个将用于向第一个 laravel 应用程序发出请求。 The second application will also have a login form.第二个应用程序也将有一个登录表单。 On the submit of the login form, I am sending the form data to the first application which in return gives back the user data.在提交登录表单时,我将表单数据发送到第一个应用程序,该应用程序返回用户数据。 Now what I want is to log the user into the second application without using its own database(second application database).现在我想要的是在不使用自己的数据库(第二个应用程序数据库)的情况下将用户登录到第二个应用程序。

You can use JWT for authentication purposes.您可以使用 JWT 进行身份验证。 In both MS you must use the same Signing Key在两个 MS 中,您必须使用相同的签名密钥

https://jwt-auth.readthedocs.io/en/develop/laravel-installation/ https://jwt-auth.readthedocs.io/en/develop/laravel-installation/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM