4

我是用户 HWIOAuthBundle(我们称之为 MyClient)使用 FOSOAuthServerBundle(我们称之为 MyServer)连接到 Symfony 2.3.2 OAuth 2 服务器。我能够连接并登录并执行我需要的请求,但一个小时后我一直被引导出“MyServer”(401 错误)。我已经阅读了大量有关此问题的内容,但似乎找不到解决方案。

我是 OAuth 新手,但我相信我使用的 access_token 会在一小时后过期。

我想知道是否有办法将两台机器配置为使用刷新令牌(将在 2 年内到期)在我的 access_token 到期时“刷新”它?

我一直找不到有关如何执行此操作的示例。任何帮助都会很棒。

干杯

4

1 回答 1

1

HWIOAuthBundle 使用 Google 登录进行身份验证时遇到了同样的问题。最后我找到了如何请求离线访问。在 config.yml 中将选项设置access_typeoffline

hwi_oauth:
    firewall_name: main
    fosub:
        properties:
            google: googleId
    connect:
        account_connector: acme.security.provider.user
    resource_owners:
        google:
            type:                  google
            client_id:            <my_id>
            client_secret:     <my_secret>
            scope:               "https://www.googleapis.com/auth/userinfo.email    https://www.googleapis.com/auth/userinfo.profile     https://www.googleapis.com/auth/analytics.readonly"
            options:
                access_type:     offline

查看更多https://github.com/hwi/HWIOAuthBundle/issues/375

于 2013-10-15T14:16:04.883 回答