Skip to content

v7.0.3

@driesvints driesvints tagged this 22 Oct 14:47
This commit adds the ability to retrieve the current client from the request, just like the current user is retrieved. I chose to do this in the TokenGuard class since this class uses the same logic to retrieve the current active user.

Usage could be as follows:

    $client = $tokenGuard->client($request);

One of the biggest reasons for adding this is that there isn't any way at the moment to retrieve the current client from the request. By adding this, users can use the client to further perform authorization actions or check the creator of the client and subsequently limit resources bases on either one of those two.

This is especially helpful for client credentials grant requests where you simply don't have an active user. This way you can still limit resources if you want based on either the client or its creator.

This commit is fully BC. No methods have been renamed, only added. The ones that have been modified still behave in the same way as before but only have some parts extracted to other methods so their code could be re-used.

This solves the following long outstanding issue: https://github.com/laravel/passport/issues/143
Assets 2
Loading