laravel / nova-issues

557 stars 34 forks source link

Laravel Nova logging in *correctly throws a 403 forbidden error #2269

Closed Sam-Xronn closed 4 years ago

Sam-Xronn commented 4 years ago

Description:

When logging in with correct user credentials the user is forwarded from /nova/login to /nova however a 403 forbidden error is thrown. It's now impossible for the user to logout (a session does exists) or accesses any part of the nova CMS.

Following the steps from a past issue request no longer works. https://github.com/laravel/nova-issues/issues/1633

It does state logging in as a user that doesn't have permission I see nothing in the docs regarding this.

Steps To Reproduce:

Login to nova using the correct details. We have found a single user account that logins in successfully every time, however, any other user account fails.

Note* No changes have been made to the user's table

Sam-Xronn commented 4 years ago

The email wasn't added to the gate now the application has gone from local to production.

app/Providers/NovaServiceProvider.php

ngtranthanhtoan commented 4 years ago

In the production environment, Nova can only access by the user that is find in the Gate in the NovaServiceProvider. You have to specify the user or the role of users that can access.

  /**
     * Register the Nova gate.
     *
     * This gate determines who can access Nova in non-local environments.
     *
     * @return void
     */
    protected function gate()
    {
        Gate::define('viewNova', function ($user) {
            return in_array($user->email, [
                'admin@email.com'
            ]);
        });
    }
fabiov commented 2 years ago

Please explain that in the documentation.

martin-ro commented 2 years ago

Please explain that in the documentation.

It's right there https://nova.laravel.com/docs/3.0/installation.html#authorizing-nova

nhuethmayr commented 1 year ago

Please explain that in the documentation.

It's right there https://nova.laravel.com/docs/3.0/installation.html#authorizing-nova

New link https://nova.laravel.com/docs/installation.html#authorizing-access-to-nova