laravel / passport

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

Cannot Custom Handle `Laravel\Passport\Exceptions\OAuthServerException` in Laravel 11 #1756

Closed rulim34 closed 2 months ago

rulim34 commented 3 months ago

Passport Version

12.2.0

Laravel Version

11.10.0

PHP Version

8.2.19

Database Driver & Version

MariaDB docker

Description

I tried to custom render Laravel\Passport\Exceptions\OAuthServerException on Laravel 11 as per the documentation. But it doesn't work and just return the default JSON response. image image image

Steps To Reproduce

  1. Install Laravel 11
  2. Install Passport 12
  3. Setup custom render
driesvints commented 3 months ago

Heya, thanks for reporting.

We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here? Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.

laravel new bug-report --github="--public"

Please do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue.

Thanks!

rulim34 commented 3 months ago

Hi,

Sure, here is the repository: https://github.com/rulim34/laravel-oauth-exception.git

driesvints commented 3 months ago

I wonder what happened here because this should be possible after @matt-allan's PR here: https://github.com/laravel/passport/pull/1066. But maybe something broke with Laravel 11. Would appreciate any help here...

github-actions[bot] commented 3 months ago

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

hafezdivandari commented 3 months ago

You may check PR #1763

codespearhead commented 2 months ago

@rulim34 https://github.com/laravel/passport/pull/1763 was merged into https://github.com/laravel/passport/tree/13.x two days ago. Can you close this issue?

driesvints commented 2 months ago

Ty!