Skip to content

New authorization view response for custom views #1607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed

New authorization view response for custom views #1607

wants to merge 6 commits into from

Conversation

jonerickson
Copy link
Contributor

The following PR allows customization of the view used for authorization. While you can publish Passport's views and edit them to your needs, unfortunately, this limits you to only the blade. This PR follows Fortify's precedence and allows you to pass a callback or string to a new Passport::authorizationView() function. The following example is how one would return and render an Inertia component for use with authorization.

Example:

AppServiceProvider.php

public function register() {

    // Return and render our custom Inertia component for authorization
    Passport::authorizationView(function ($parameters) {
        return Inertia::render('Passport/Authorize', [
            'client' => $parameters['client']->id,
            'name' => $parameters['client']->name,
            'scopes' => $parameters['scopes'],
            'state' => $parameters['request']->state,
            'authToken' => $parameters['authToken'],
            'csrfToken' => csrf_token(),
        ])->toResponse($parameters['request']);
    });
}

@driesvints
Copy link
Member

Tests are failing here and there's quite a few unrelated styling changes. Please adjust them and mark as ready when done.

@driesvints driesvints marked this pull request as draft December 14, 2022 10:06
@xaoseric
Copy link

Any update on this?

@driesvints
Copy link
Member

Feel free to resend with passing tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants