-
Notifications
You must be signed in to change notification settings - Fork 389
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
FailureError('Unable to retrieve token secret from storage!',) #11
Comments
I started trying to get something going on this, I figured it might be straightforward since Pyramid is based on WebOb, too. Finally just got it to actually compile with the module included, realized I was missing the openid module in my virtualenv. |
I'm getting there I think, but am running into errors working with Twitter. Things seem to be hooked up, but I'm getting an error returned after the .login() method. This is what I'm getting in the logs from my login handler: 2013-06-22 14:16:52,504 INFO [authomatic.core][Dummy-2] authomatic: Twitter: Starting OAuth 1.0a authorization procedure. [At this point it appears that it's re-entering my login page. I'm not sure if this has anything to do with the callback URL set up on Twitter or not?] 2013-06-22 14:16:55,439 INFO [authomatic.core][Dummy-3] authomatic: Twitter: Continuing OAuth 1.0a authorization procedure after redirect. Then after that it never gets past the LoginResult error. I'm not sure if it's something with how I wired up the PyramidAdapter or if it's something with how I've set up my Twitter app dev settings? Any thoughts? Thanks! |
So it seems that it's losing it's session value ('token_secret') after the the oauth 1.0a redirect. The session setting and getting does seem to work, as I've added some logging statements to try and see what's going on. It does set it and I'm able to immediately pull the value back out. But somehow after it redirects and re-enters login() 'token_secret' is no longer there to get. |
@petertirrell Sorry for delayed response. I never get notifications on new issues. |
Ugh - I responded last night and apparently it didn't post. Sorry! I haven't tried with anything but Twitter but I'll try setting it up with Facebook or Google. I added a repo (https://github.com/petertirrell/LoginProject) with the Pyramid project I've been working with to set this up if you're interested. |
Great. I will have time to look at it not sooner than next week. |
Thanks for your time! For what it's worth, I get the same behavior on Twitter, Facebook, and Google. At this point I think it might be related to Pyramid's session or cookie management....like the cookie that is used to set the token_secret isn't the same that is checked after the redirect. I'm trying to read up more on what is going on because it seems so close to working. Thanks again, |
@petertirrell This is really strange. I have created a simple pyramid example just with the But I recieved an email from a guy who is getting the same error with Django just by running the django example. He tried it also with the django session but with the same result. The problem is that I cannot reproduce the error. Could you please provide as many details as you can about your environment (OS, python version, browser etc.)? |
Have you tried clearing your cookies on twitter? I ran into this with Facebook today after changing our route for sn authorizations. There were some old cookies hanging around with the wrong pathing causing the error. Inspect your cookies both on your domain AND on the SN and make sure everything has the right path. |
I have tried everything to reproduce it. I have changed the routes, switched frameworks, browsers, sessions and their backends but it still works 😬 |
Interesting, thanks for the feedback! Your example looks like what I was trying to do so I'm going to go back through my code and see where I'm straying. At least it's good to know that it does work, just that I'm doing something wrong. I did eventually get it to save the token, but by passing my beaker session to the login() function....which worked the first time but then started throwing me errors on subsequent tries :-). I'll check my cookies, too...I wondered if maybe I needed to clear things out. |
Frustrating, I'm still having problems! I'm basically mirroring the simple pyramid example now, just that it was based on the SQLAlchemy pyramid scaffold. My example is here, everything should be in the views.py file. For everything it's back to "Damn that error: Unable to retrieve token secret from storage!". I tried running it in Chrome Incognito mode, too, and it gives the same behavior. My environment is Ubuntu 13.04, Pyramid 1.4, Python 2.7.4 in a virtualenv. The browser I'm testing with is Chrome stable on Ubuntu. --ugh. So as I'm writing this I just tried in Firefox on here and it actually works. Both Facebook and Twitter. So I'm still going to post the comment in case something jumps out, but apparently there's something wrong with my Chrome session...not sure why the incognito doesn't fix that but at least that's a lead I can go on! Always PEBKAC isn't it! |
@petertirrell I was playing with the previous version of your LoginProject and the problem was that the This however didn't solve the issue with the lost session. I have tried the last version of the LoginProject with Pyramid 1.4.2 in venv but on Ubuntu 12.04 and it works in every browser I have. Also the previous version worked after I fixed the |
Yeah, I saw after coming back that my response wasn't set up right. Thanks for looking into this - feel free to close this issue out. I looks like Authomatic works just fine in Pyramid, too, so it's just a matter of me figuring out what's going on with my system to cause me fits. Thanks again for all of your help! |
I have renamed the issue so it reflects the problem with the session. I will keep it open till we find out what's causing it so it can help other people having the same problem. |
I haven't had a chance to test it yet, but I think from reading it might have something to do with my chrome setting to 'continue where I left off' on startup. I think when I was messing with creating an actual PyramidAdapter (unnecessary now) I polluted my session cookie and it is still persisting. And from a chromium bug I found this persists even in incognito mode. When I get home I want to try and blow away my cache and everything in Chrome and see if that makes it work. |
I hit this issue today, and with much trial-and-error I have found some work-arounds that seem to help, at least for Chrome on OSX. The root problem seems to be buggy cookie-setting behaviour by WebKit-based browsers on redirects, per http://stackoverflow.com/questions/1144894/safari-doesnt-set-cookie-but-ie-ff-does Basically, Authomatic's Set-Cookie directive is incorrectly ignored by the browser in some circumstances when performed as part of a redirect, as it is for the Twitter auth flow (and likely many others) In my particular case, running my dev site on "localhost" seemed to trigger the problem. Each of the following changes caused Chrome to set the cookie as it should:
I'll follow up shortly with a pull request containing the latter "fix". Hopefully with the details I've given above others will be able to reproduce the issue and confirm/contest the fix. |
Ugh, further testing shows that I was mistaken about the This leaves me with removing the What a mess... |
Make WebKit-based browsers set cookies on redirect in more cases, fixes #11
Thanks James. I'm not sure whether removing the |
You're welcome @peterhudec, thanks very much for Authomatic! Removing the Why removing the explicit |
Thanks @jmurty! That did do the trick - works like a dream on my Chrome now, too. |
Some users are reporting lost session after redirect within the login procedure.
the original issue as opened by @petertirrell was:
Pyramid Adapter and example
Implement an adapter for the Pyramid framework with example.
The text was updated successfully, but these errors were encountered: