Skip to content

Cryptic part missing elaboration in Nova 4 upgrade guide #3965

@piljac1

Description

@piljac1
  • Laravel Version: 9.8.1
  • Nova Version: 4.1.0
  • PHP Version: 8.0.16
  • Database Driver & Version: MySQL 8.0.21
  • Operating System and Version: macOS Monterey 12.1
  • Browser type and version: Google Chrome 100.0.4896.75
  • Reproduction Repository: Private

Description:

There is a part of the upgrade guide, listed as low priority, that states the following:

Eloquent User Provider Required

Nova 4 requires the authentication user provider to be eloquent in order to resolve information regarding the currently authenticated user.

In your application's default config/auth.php configuration file, the Eloquent user provider is specified and it is instructed to use the App\Models\User model when retrieving users. You may change these values within your configuration file based on the needs of your application.

Can we get some elaboration from the core team (either here or the upgrade guide) as to why is that the case and what Nova features are affected by this, so we can be aware of what we can change/disable in order to circumvent that change. We have to specifically (asked by the customer) use Auth0 as a provider in our app. It worked in Nova 3 and seems to work in Nova 4, but we haven't tested all features yet, including new features.

Here's how our Auth0 setup works:

// auth.php

'defaults' => [
    'guard' => 'auth0',
    // ...
],

'guards' => [
    'auth0' => [
        'driver' => 'auth0',
        'provider' => 'auth0',
    ],
    // ...
],

'providers' => [
    'auth0' => [
        'driver' => 'auth0',
        'repository' => App\Auth\UserRepository::class,
    ],
    // ...
],
<?php

namespace App\Auth;

use App\Models\User;
use Auth0\Laravel\Contract\Auth\User\Repository;
use Illuminate\Contracts\Auth\Authenticatable;

class UserRepository implements Repository
{
    /**
     * @inheritdoc
     */
    public function fromSession(array $user): ?Authenticatable
    {
        return User::makeFromAuth0UserInfo($user);
    }

    /**
     * @inheritdoc
     */
    public function fromAccessToken(array $user): ?Authenticatable
    {
        return User::makeFromAuth0UserInfo($user);
    }
}

P.S. User::makeFromAuth0UserInfo($user); creates a new App\Models\User instance, but it is not persisted in the database (no users table).

Detailed steps to reproduce the issue on a fresh Nova installation:

  • Unknown (need more info from the core team)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions