Git Product home page Git Product logo

auth's People

Contributors

ericyzhu avatar fcmhub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

auth's Issues

登录认证报错

Entry "HyperfExt\Auth\UserProviders\ModelUserProvider" cannot be resolved: Parameter $options of __construct() has no value defined or guessable\nFull definition:\nObject[HyperfExt\Auth\UserProviders\ModelUserProvider

composer require hyperf-ext/auth安装出错

Using version ^2.1 for hyperf-ext/auth
./composer.json has been updated
Running composer update hyperf-ext/auth
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Root composer.json requires hyperf-ext/auth ^2.1 -> satisfiable by hyperf-ext/auth[v2.1.0].
- hyperf-ext/auth v2.1.0 requires hyperf/command ~2.1.0 -> found hyperf/command[v2.1.0-beta1, v2.1.0, 2.1.x-dev] but it conflicts with your root composer.json require (~2.2.0).

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

The hashing driver config bcrypt is invalid.

/**
* @Inject
* @var AuthManager
*/
protected $auth;

public function createToken(): string
{
    $user = MemberAuth::find(1);
    $this->auth->guard('api')->attempt($user);
}

我使用后报如下错误:
InvalidArgumentException: The hashing driver config jwt is invalid.
这是我的auth.php:

[ 'guard' => 'api', 'passwords' => 'users', ], /* |-------------------------------------------------------------------------- | Authentication Guards |-------------------------------------------------------------------------- | | Next, you may define every authentication guard for your application. | Of course, a great default configuration has been defined for you | here which uses session storage and the Eloquent user provider. | | All authentication drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage | mechanisms used by this application to persist your user's data. | */ 'guards' => [ 'web' => [ 'driver' => \HyperfExt\Auth\Guards\SessionGuard::class, 'provider' => 'users', 'options' => [], ], 'api' => [ 'driver' => \HyperfExt\Auth\Guards\JwtGuard::class, 'provider' => 'users', 'options' => [], ], ], /* |-------------------------------------------------------------------------- | User Providers |-------------------------------------------------------------------------- | | All authentication drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage | mechanisms used by this application to persist your user's data. | | If you have multiple user tables or models you may configure multiple | sources which represent each model / table. These sources may then | be assigned to any extra authentication guards you have defined. | */ 'providers' => [ 'users' => [ 'driver' => \HyperfExt\Auth\UserProviders\ModelUserProvider::class, 'options' => [ 'model' => App\Domain\MemberAuth\MemberAuth::class, 'hash_driver' => 'bcrypt', ], ], // 'users' => [ // 'driver' => \Hyperf\Auth\UserProvider\DatabaseUserProvider::class, // 'options' => [ // 'connection' => 'default', // 'table' => 'users', // 'hash_driver' => 'bcrypt', // ], // ], ], /* |-------------------------------------------------------------------------- | Resetting Passwords |-------------------------------------------------------------------------- | | You may specify multiple password reset configurations if you have more | than one user table or model in the application and you want to have | separate password reset settings based on the specific user types. | | The expire time is the number of minutes that the reset token should be | considered valid. This security feature keeps tokens short-lived so | they have less time to be guessed. You may change this as needed. | */ 'passwords' => [ 'users' => [ 'driver' => \HyperfExt\Auth\Passwords\DatabaseTokenRepository::class, 'provider' => 'users', 'options' => [ 'connection' => null, 'table' => 'password_resets', 'expire' => 3600, 'throttle' => 60, 'hash_driver' => null, ], ], ], /* |-------------------------------------------------------------------------- | Password Confirmation Timeout |-------------------------------------------------------------------------- | | Here you may define the amount of seconds before a password confirmation | times out and the user is prompted to re-enter their password via the | confirmation screen. By default, the timeout lasts for three hours. | */ 'password_timeout' => 10800, /* |-------------------------------------------------------------------------- | Access Gate Policies |-------------------------------------------------------------------------- | */ 'policies' => [ //Model::class => Policy::class, ], ]; 顺便想问一下使用文档何时更新,觉得您jwt和这个项目的代码质量很高,在持续关注中。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.