-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Oauth sign-in fails in Chrome when third party cookies blocked #72
Comments
I see this error in the console too, when logging in to antislaverymanuscripts.org with 3rd party cookies disabled: Does that iframe try to set a cookie on the zooniverse.org domain? |
That is due to the lack of a session on the API, once you authenticate via the redirect process the iframe should launch fine for that domain. |
This error shows on the reload, after I've signed in at panoptes.zooniverse.org. |
OOI - which browser? With 3rd party tracking enabled, Firefox 58 works ok for me without a whitelist for that domain, chrome 63 requires me to whitelist that domain else the cookie doesn't get sent and the iframe is rejected without a session. |
Latest Chrome on OSX El Cap, with 3rd party cookies disabled in browser privacy settings. I've traced the error as far as this section of code, when 3rd party cookies are disabled. panoptes-javascript-client/lib/oauth.js Lines 181 to 183 in 85bdc16
I think that cookie setting causes a Security Error to be raised by the iframe, which then blocks the auth flow. I'm not 100% sure why there's an iframe loading from panoptes.zooniverse.org. Is it there to refresh tokens for long sessions? I guess that would be blocked by browser security rules anyway. |
The cookie is actually set while the browser is still on panoptes.zooniverse.org, as far as I can tell from following the HTTP requests and responses, but of course it can't be read by an iframe if 3rd party cookies are blocked by antislaverymanuscripts.org. |
WTF is this line of code doing? I think it may be the cause of the error. panoptes-javascript-client/lib/oauth.js Line 172 in 85bdc16
|
The initial login flow is via page redirects, and the token is provided in the url fragment on redirect back from panoptes / login server. The iFrame is to refresh the token without redirecting users in the middle of a task and thus losing data, unexpected page behaviour from sites, etc. This was the first way Roger got it working for refreshing, load the iFrame in the background to get the token without any page redirection.
Yep
This will hinder the ability to refresh the token (what the iframe is for), but not the inital redirection flow that does return the access code (look closely at the URL you should see the fragment on initial redirection before the JS strips it out. The issue is that the iframe code is stopping login full stop, even though it should be ok. Borked token refreshes are another issue and something we will have to look at (ouroboros does a funky scheme for this with an api proxy). |
Re #72 (comment) is that line just a fancy way to get the URL from the create iFrame context to the onload event? |
I don't think this is what the code is actually doing, if my reading of this function is correct. It seems to be getting your session from a temporary iframe, which is then destroyed. panoptes-javascript-client/lib/oauth.js Lines 154 to 190 in 85bdc16
|
Should this session check be in an panoptes-javascript-client/lib/oauth.js Lines 75 to 85 in e245e6b
|
The comment says 'If not…' but there's no conditional around that block. 🤔 |
Itinitally the sign in button will do wire up a full redirect with the panoptes oauth URL, clicking sign in takes me to this URL. panoptes-javascript-client/lib/oauth.js Line 103 in 85bdc16
That iframe runs but it shouldn't fire until the user has a session on the oauth server. I assume based on the console warnings it does fire on page load...be nice to not use this iframe for anything but refreshing the token by converting my panoptes session (with cookie) to an oauth token. |
Probably - there are two distinct behaviours here:
|
I missed that |
Yeah - the point of that initial assigns is to wire up the signin button to redirect. After that it won't set the assign as the token exists.. |
But there's no token after the redirect, and iframes are blocked so that method fails to get the session. This is where the code is failing. I think it should be using |
The token does exist after a redirect back from the oauth provider.... it's in the url fragment. |
I meant after An alternative solution would be to write state to session storage before the |
You can debug this in the Chrome network panel by checking the box to preserve logs across page refreshes. |
Sorry, I should have linked to the code. This is the redirect that breaks login, not the one you linked above. I think we've been talking about two different bits of code. panoptes-javascript-client/lib/oauth.js Lines 70 to 72 in 85bdc16
|
Linked to #30
The oauth flow works and the access_token is returned in the URL fragment however that redirect response tries to set a cookie as well. I assume this cookie set failure causes the code / a promise to fail even though we have all the information we need to authenticate the user.
Steps to recreate:
Happy to help debug this as well
The text was updated successfully, but these errors were encountered: