Oauth2 & Laravel - `Client_id` & `Client_secret` - 在哪里放置、存储、调用?

Oauth2 & Laravel - `Client_id` & `Client_secret` - where to place, store, call?

我正在使用 OAuth-Server-Laravel repo docs 并且我正在使用 Lumen。我已成功将工作客户端凭据授予类型并尝试将其移至密码授予类型。

我添加了具有 verify() 功能的 PasswordVerifier class,将我的数据库 oauth_clients table 更改为:

        $table->string('id', 40)->primary();
        $table->string('username');
        $table->string('password');
        $table->string('email');
        $table->timestamps();

        $table->unique(['id', 'username']); 

verify() 函数为:

        'username' => $username,
        'password' => $password,

当我在 Postman 中尝试时,我收到: "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the \"client_id\" parameter."

然后我阅读了这些问题,发现我需要在 usernamepassword 凭据旁边导入 client_idclient_secret。我明白这些是我应该定义的东西。

但是,我不知道在哪里放置、存储和调用它们?我应该将它们存储在 .env 文件中吗?如果是这样,我应该如何在验证函数中调用它?

应该有一个 oauth_clients table 由该包创建。这定义了哪些客户端有权对您的资源服务器进行 API 调用。您的授权服务器验证这些客户端是否存在于此 table 中,并且无论何时从客户端发出请求,机密都匹配。

那个table的结构是这样的:

id (primary)
secret
name
created_at
updated_at

此 table 中的每个条目代表一个客户端 应用程序 ,它可以某种方式访问​​您的 API。