Search code examples
laravellaravel-5oauth-2.0laravel-passport

Laravel Passport Oauth Customize page / auto redirect


Hi I would like to ask about laravel passport oauth confirmation page

enter image description here

This is the page when we are asked for authorization, I would like to customize this page, or even possible to skip this page to always authorize anyway since the requestor will be just an internal application

I tried to google this but no luck. Is that possible? if so please tell me how to, or any link will be greatly appreciated


Solution

  • If you want to change the UI you can actually export the view and edit it https://laravel.com/docs/5.5/passport#requesting-tokens

    For the auto redirection, actually it can be done using laravel passport version ^7.30

    Code: https://github.com/laravel/passport/pull/1022

    Documentation: https://github.com/laravel/docs/pull/5226

    But since I was using laravel version that dont support passport ^7.30, I need to create the override reference: https://github.com/laravel/passport/issues/243

    What I did was, I copied this snippets https://paste.laravel.io/6LN6q

    Creating a new class extending the passport AuthorizationController and overriding the authorize function only