Forums

problem with Flask and Google OAuth2

I have example code taken from "https://github.com/zeraholladay/Flask-Oauth2-Example"

This is working perfectly as a localhost. but when i am trying to setup this at PAW; on browser it is showing "500 Internal Server Error". .while its Error log is showing error as "error: [Errno 101] Network is unreachable"

Any idea how to solve this??

Is the site you're trying to connect to on our whitelist?

yes.. .it is present in whitelist. . its "google.com". .

My best guess is that the flask-oauth app isn't using the proxy server correctly. As an experiment, you could try upgrading your account, and you'll get unrestricted internet access, and see if that fixes it.... There's a 30-day no-quibbles money back guarantee, so if it doesn't work or you decide you don't want to use PythonAnywhere after all, we'll happily refund you!

Another option would be to post your code and ask someone with a paid account to test it out for you.

@a2j: source code is at "https://github.com/zeraholladay/Flask-Oauth2-Example"

i have the same problem with flask-oauth. Please, let me know if you fix this error. l'll try to use paid account some days later.

Hi tema, it's a problem trying to use OAuth2 over the proxy. Like Harry said, there is no risk to upgrading and seeing if you can get your app to work.

Did you get anywhere with this problem? I've tried two flask libraries for google login and both fail to work with pythonanywhere (but are fine with localhost)

I believe it should now work even for free accounts. The issue was that there was a bug in many Python url handling libraries. The bug is fixed in the latest requests and since the flask oauth example uses requests, it should work.

Just to make it completely clear -- the original problem posted in this thread was specifically about problems with OAuth and free accounts. If you're having a problem with OAuth with a paid account, it's something completely new -- we'd love to know more about the problem. Do you have any error messages or logs that might help debug?

Thanks Giles, that's clear to me. In fact you helped me before looking into problems with one library - I also tried flask-googlelogin - but that also has the same problem (works locally, not on pythonanywhere). Have given up temporarily and using simple db login. Still looking for a solution! (But thanks for your past help - because of you I decided to sign up for a paid account!)

Ah, of course -- I remember the discussion. Thanks for signing up for the paid account :-D

It's really odd that it's still not working on PythonAnywhere with the paid account, though. I really can't think of anything that would make that different to your local machine. Unless (straw-clutching here) your local machine is a Windows one and there's something in the chain that's breaking due to case sensitivity?

I'm on Crunchbang Linux so hopefully no case-related weirdness going on. I've got a few more oauth libraries to try - but giving it a rest for now because Google oauth is a lot more complicated than I thought. I feel it's to do with the difference between locally hosted and cloud hosted calls to Google oauth - but I can't tie it down right now; was hoping someone else had some ideas.

Right, agreed that there should be no case-related weirdness going Linux to Linux (BTW I'd not heard of Crunchbang before, thanks!).

Here's hoping that someone else around here comes across this post and works out the solution. Perhaps Stack Overflow would also be a good place to ask?

This fixed it for me: http://stackoverflow.com/questions/17092849/flask-login-typeerror-decoding-unicode-is-not-supported

Excellent, thanks for posting that!