-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Google - continually use refresh token ( NOT Working ) #218
Comments
@kishore1431 can you share what your relevant config options are? Also, are you seeing any errors in the oauth2_proxy logs? |
Here are the config options that i am using. I don't see any errors but i no longer see the below statement in the logs "2016/02/24 11:45:02 google.go:154: refreshed access token Session{[email protected] token:true expires:2016-02-24 12:45:02 -0800 PST refresh_token:true} (expired on 2016-02-24 11:21:58 -0800 PST)" I rolled back to v2.0.1 and the refresh access token is working as expected but this version has "approval_prompt" hardcoded to "force" in the code :(. Note: used dummy cookie/domain names. approval_prompt="auto" |
@kishore1431 are you sure you are not just observing the timeout passed the 9h cookie TTL? (FWIW, i run with expiration set to |
@jehiah :). Its definitely not the 9h timeout, its timing out every 60 mins and asking user to login again. |
Yes i have same issue. All cookie refresh is working, and there is valid response from google:
in config:
As we see in log output above, we have
Last try to refresh cookies session failed because access token in Google expired and it is not refreshed in last 3600 seconds. oauth2_proxy/providers/google.go Line 154 in d49c3e1
Only way to start working again is refresh whole site in browser. This is especially bad idea when we operate on site with many javascripts and after 1 hour any request from javascript failing. |
More update. Looks like problem exists only on pages that use xhr requests from javascript. After one hour when access token expires and full auth is triggered for any request (cookie refresh and session expires in oauth2) then any request from javascript inside page fails. I think main problem is that access token in oauth2 proxy is only redeemed when all sessions expired and triggers whole auth from web page side (using auth_request from nginx). This should be refreshed in background just like cookie refresh. |
Error from Google:
Origin is available in request headers to Google. My origin is set in google developers panel in |
Hi, I believe we are seeing this also, is there a workaround or fix available for this? |
@szibis, where are you seeing that xhr error? In the logs for oauth2_proxy or somewhere else? |
Hi all. We also suffer from this in a heavily-Javascript based webapp. It's been really quiet on this bug for months - any progress / workarounds / whatever that can help move forward? We can code a bit too, but we don't know anything about Go. :) |
@antgel If you can confirm this is still a problem against the most recent release (v2.1) or HEAD and provide steps to reproduce that would be helpful. |
So, we are using the latest version with the auth_request, the users authenticate using a web page, but then they are redirected to a single page app and only use AJAX. And we see in the oauth2_proxy logs that it doesn't update their cookie, only removes it. Reproduction is hard as our app is internal. Would you be up for doing a screenshare, or I could send screenshots or logs, or anything you tell me that would be useful. Sorry to be difficult but we would like to help. I see lines in the log like: |
I'm no longer seeing this bug (since after I originally reported it) but suspect that something else in our infrastructure - specifically outbound proxy filtering - was causing the issue |
We don't have anything fancy going on like that. |
@jehiah Any interest in a screenshare or similar as above? What sort of data would you need from us to reproduce the issue? Might logs help? |
@jehiah What else do you need from us? This is happening in all releases ( I tried all from versions in 2.x). The refresh token is set to 3600 sec. whatever I do, it is expiring and timing out the user after 1 hour. Here is my config, cookie_name = "_oauth2_foo_bar" and the oauth2_proxy logs. 2017/04/21 17:35:28 oauthproxy.go:458: 10.111.227.113:44078 refreshing 4m17s old session cookie for Session{[email protected] token:true expires:2017-04-21 17:51:58 -0700 PDT} (refresh after 1m0s) |
Someone mentioned For |
This works for me, for refreshing the cookie via location / {
auth_request /oauth2/auth;
error_page 401 = /oauth2/sign_in;
auth_request_set $auth_cookie $upstream_http_set_cookie;
proxy_pass http://apps;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $host;
add_header Set-Cookie $auth_cookie;
} |
@ploxiln It is multiple problems in one time. It is not working because google session expires in 1h if you are not active in 1h then after any javascript action, you get session refresh trying which remove session because it's expired and then trying to sign_in and no cookie set because you are not logged in. You need to refresh the whole page to sign_in and then you have next 1h of working and again if only javascript actions on your site (which is standard now) then you will get failed requests after 1h. And yes Log here with domains changed - i was back after night and need to refres whole page and sign in:
After page refresh and sign in:
My oauth2 config:
And nginx conf section:
My workaround is to add dynamically to any site proxied through Nginx HTML code with an iframe which will be loaded in defined refresh rate and sign-in through normal GET if expires in the background, but this is a huge hack and not working with all possible scenarios. This needs separate configuration got sign_in to be automatic without a sign_in page in oauth2_proxy of course not as the Nginx config I added above. |
If those are your real |
Of course they are fake, randomly changed. |
I'm using oauth2_proxy 2.2.0 (and cookie refresh is still working for me, using github provider) |
@ploxiln I am having issues with Google login. I did few changes recently so I will give it a shot again. The other issue that I see is with setting cookie_secure = true, when I set this config to true the OAuth session breaks in the new tab. when I access the same url in a new tab, it forces me to log in again. |
If |
This issue is quite old by now, but maybe my findings in #632 help some others to fix their own problems. |
The refresh access token is not happening on the master branch. The pull request #117 solved this but looks like its broken on the master branch. The session times out after 3600 seconds and asks user to login again.
The text was updated successfully, but these errors were encountered: