laravel / passport

Laravel Passport provides OAuth2 server support to Laravel.
https://laravel.com/docs/passport
MIT License
3.29k stars 780 forks source link

[13.x] Fix user-token relations #1773

Closed hafezdivandari closed 4 months ago

hafezdivandari commented 4 months ago
  1. $user->getProviders() has been added recently on PR #1768, this method actually must not return null in a healthy environment / configuration. Also, it is not possible to use Passport with a database provider. This PR fixes these 2 situations on this method.
  2. The relation between the authenticable model (User model by default) and Token model depends on the client's provider. This PR makes sure we are retrieving the tokens associated with the right authenticable model and adds integration tests for this.
    • Note: On Sanctum user->tokens() relation is morphable, so we know which model is the owner of the key, on Passport we should check the client's provider to know which model is the owner of the key.
github-actions[bot] commented 4 months ago

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.