【发布时间】:2016-01-22 05:24:16
【问题描述】:
我在我的 Web 应用程序中使用 zf2 apigility。在生产模式下,如果config_cache_enabled 在config/application.config.php 中为true,我在请求access_token 时收到此消息错误:
缺少 OAuth2 的存储配置
如果我将其设置为false,我将获得我的访问令牌。
所以我的问题是将config_cache_enabled 设置为true 并成功请求在生产模式下获取访问令牌,因为缓存配置时性能最佳。该怎么做?
这是我的zf-mvc-auth 配置:
'zf-mvc-auth' => array(
'authentication' => array(
'adapters' => array(
'CustomStorage' => array(
'adapter' => 'ZF\\MvcAuth\\Authentication\\OAuth2Adapter',
'storage' => array(
'storage' => 'Application\\Adapter\\OAuth\\CustomPdoAdapter',
'route' => '/oauth',
),
),
),
),
),
这是我的 oauth2.local.php :
'zf-oauth2' => array(
'db' => array(
'dsn' => 'mysql:dbname=mydatabase;host=localhost',
'username' => 'root',
'password' => '',
),
'allow_implicit' => true,
'access_lifetime' => 3600,
'enforce_state' => true,
'storage' => 'Application\Adapter\OAuth\CustomPdoAdapter',
'storage_settings' => array(
'user_table' => 'users',
),
'options' => array(
'always_issue_new_refresh_token' => true,
),
),
我认为它配置得很好。
【问题讨论】:
标签: php zend-framework2 oauth-2.0 access-token laminas-api-tools