当我们有多个客户端时如何限制对 Passport 客户端凭据授予类型的访问

How to restrict access in Passport Client Credentials grant type when we have multiple clients

我想为两家银行(机器对机器)提供API。据我所知,为此目的最好的授权类型是客户凭证。但是如何限制bank A只能访问ControllerA,bank B只能访问ControllerB呢?

为这些银行创建两个用户似乎不对!

您可以使用中间件 (https://laravel.com/docs/5.7/middleware#assigning-middleware-to-routes) like the ‘checkRole’ example and optionally, use token scopes (https://laravel.com/docs/5.6/passport#token-scopes) 来保护您的路由。