FOSOAuthServerBundle + HWIOAuthBundle Timeout after an hour 401

I am using an HWIOAuthBundle (letting it be MyClient) to connect to the Symfony 2.3.2 OAuth 2 server using FOSOAuthServerBundle (let me call it MyServer). I can connect and log in and execute the requests that I need, but I continue to boot from "MyServer" after an hour (error 401). I read a lot about this problem, but I can not find a solution.

I am new to OAuth, but believe that the access_token that I use expires in an hour.

I was wondering if there is a way to configure both machines to use an update token (which expires in 2 years) in order to β€œupdate” my access_token when it expires?

I could not find an example on how to do this. Any help would be great.

Greetings

+4
source share
1 answer

I had the same issue with the HWIOAuthBundle for authentication with Google Login. Finally, I found how to request offline access. In config.yml, set the access_type option to 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 

Read more https://github.com/hwi/HWIOAuthBundle/issues/375

+1
source

Source: https://habr.com/ru/post/1494177/


All Articles