0

我在使用这个库时遇到了问题。客户端上使用的代码与服务器上运行的代码相同。令牌的生命周期为 1440 分钟,但此配置仅适用于本地服务器,不适用于远程服务器。

我不知道我是否应该在 apache 或系统中配置其他东西,但在 Laravel 中完全相同(我使用 git 发送更改)。在双方我都使用 Ubuntu 16.04,在我的本地服务器上我使用 php 7.1,在我的远程服务器上我使用 php 7.0。在我的本地浏览器中,我使用的是 Angular 4。我在 Laravel 中的代码是:

/*
    |--------------------------------------------------------------------------
    | JWT time to live
    |--------------------------------------------------------------------------
    |
    | Specify the length of time (in minutes) that the token will be valid for.
    | Defaults to 1 hour
    |
    */

    'ttl' => 1440,

    /*
    |--------------------------------------------------------------------------
    | Refresh time to live
    |--------------------------------------------------------------------------
    |
    | Specify the length of time (in minutes) that the token can be refreshed
    | within. I.E. The user can refresh their token within a 2 week window of
    | the original token being created until they must re-authenticate.
    | Defaults to 2 weeks
    |
    */
4

1 回答 1

0

当我上传项目时,我使用 github 完成了它(我在那里上传了我的项目)并且令牌配置在 1 分钟内完成。尽管我修改了 config/jwt.php 文件中的配置,使会话持续了一整天(1440 分钟),但它没有工作。

我所做的是再次将项目上传到新项目的 github(更新时间为 1440 分钟),这一次它确实有效。这样我就解决了我的问题。

于 2017-08-23T17:39:48.710 回答