4

我是用戶HWIOAuthBundle(我們稱之爲MyClient),使用FOSOAuthServerBundle(我們稱之爲MyServer)連接到Symfony 2.3.2 OAuth 2服務器。我能夠連接並登錄,並執行我需要的請求,但一小時後(401錯誤),我一直從「MyServer」啓動。我對這個問題做了大量的閱讀,但似乎無法找到解決方案。FOSOAuthServerBundle + HWIOAuthBundle一小時後超時401

我是OAuth的新手,但我相信我使用的access_token會在一小時後過期。

我想知道是否有一種方法來配置兩臺機器使用刷新令牌(2年後到期)來刷新我的access_token過期時嗎?

我一直無法找到如何做到這一點的例子。任何幫助都會很棒。

乾杯

回答

1

我有HWIOAuthBundle同樣的問題,使用谷歌登錄進行身份驗證。最後,我發現如何請求離線訪問。在config.yml選項access_type設置爲offline

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