r/Python • • Feb 24 '14

The Flask Authentication Problem

https://stormpath.com/blog/part-one-flask-authentication-problem
0 Upvotes

18 comments sorted by

5

u/[deleted] Feb 24 '14

There are many examples floating around on the internet (just Google Flask + authentication and you’ll see a few) which explain how to do the following:

If you actually cut that down to the database-agnostic part, you get this:

  1. use bcrypt to hash/check passwords;

  2. use flask.session to mark the client as logged in.

Everything else? Totally unrelated, especially the HTTPS "problem" (encryption is configured in the web server, not in the WSGI app.)

0

u/[deleted] Feb 24 '14

[deleted]

1

u/mercnet Feb 25 '14

Can you elaborate more on Flask-Security being too unconfigurable? I just started using it and wondering what options are missing from it?

0

u/[deleted] Feb 25 '14

[deleted]

1

u/mercnet Feb 25 '14

You can easily change the template path and filenames: https://pythonhosted.org/Flask-Security/configuration.html#template-paths

It doesn't look like you can change the directory name for emails. You can always request it at https://github.com/mattupstate/flask-security/issues?state=open

1

u/solid_steel Feb 25 '14

All those things that you mention in the first sentence are not related to authentication. That's the whole beauty of Flask - you get to get your hands dirty by building things at a basic level. If you require more magic ie. registration emails, consider shifting over to Rails and the excellent Devise gem.

3

u/dAnjou Backend Developer | danjou.dev Feb 24 '14

As a developer, this mean you don’t have to worry about user account management,  ...
And of course, the biggest issue with forcing your users to rely on social login is that you still need to implement your own user data storage: database tables, handle user relationships and security, etc.

Aren't you a little bit contradictory here?

But I mostly agree with you although some of your points are exaggerated. Who wouldn't use HTTPS?

Also, this isn't really a Flask specific problem. Do other frameworks have it figured out? If yes, why not adopt it? What't really missing is some kind of authentication standard over HTTP for APIs that are consumed by headless clients, OAuth sucks for that.

-12

u/[deleted] Feb 24 '14

great framework you have there, that doesn't even have a decent authentication model out of the box. I'll stick with web2py thanks.

5

u/7952 Feb 24 '14

Why would you expect a micro-framework to have the features of a full stack framework?

-9

u/[deleted] Feb 24 '14

Why would you expect a micro-framework to have the features of a full stack framework?

because the fucking article implied that the lack of authentication was a "problem". why don't you fucking ask the author of the article that question instead of me?

0

u/[deleted] Feb 24 '14

[deleted]

-7

u/[deleted] Feb 24 '14

Because you fucking made the fucking comment about Flask not fucking bundling an authenti-fucking-cation module.

false, the fucking article did that, I just fucking assumed that anything posted on this fucking subreddit is fucking accurate. I havent used fucking flask, so I wouldn't fucking know you fuck. from what I've fucking read, fucking flask is for fucking kids and fucking girls.

So it would fucking make sense that it would not fucking have fucking authentication out of the fucking box since fucking kids and fucking girls think fucking sharing everything and fucking trusting everyone is the fucking way it should be.

Alas, the fucking article implies that this is a fucking problem. So fucking take it up with the fucking author of the fucking post.

0

u/[deleted] Feb 24 '14

[deleted]

-1

u/[deleted] Feb 24 '14

and a fuck-ton of utilities.

except for fucking authentication apparently. usefullness plummets. why the fuck would you waste so much fucking time and fucking energy defending such a fucking obviously crippled piece of fucking shit "micro" framework. why don't you go fucking build something useful with it and then fucking blog about it. then i might be fucking impressed.

0

u/[deleted] Feb 24 '14

[deleted]

-2

u/[deleted] Feb 24 '14

It's an entire framework in itself

NO FUCKING SHIT. So explain that to the author of this fucking article instead of trying to get imaginary reddit points on the internet. Add value.....whatnot.

one mans "tantrum" is another mans performance art.

2

u/tutuca_ not Reinhardt Feb 25 '14

Most funny comment I've read all day.

0

u/[deleted] Feb 25 '14

nah there's way funnier ones in this thread. typing "web2py" is low hanging fruit as far as jokes go for this audience.

1

u/rdegges Feb 24 '14

Well, to be fair, Flask-Login is really great, but just doesn't a good enough job of forcing one model of auth, which makes it really hard to use :(

We've actually got a cool new library in the works: http://flask-stormpath.readthedocs.org/en/latest/ which aims to solve these problems.

2

u/[deleted] Feb 24 '14 edited Feb 24 '14

Wait a minute. Is your solution to literally push all user-related data to your servers via a REST API? Is it at least possible to log into multiple apps with the same account? That seems to be similar to OAuth, only worse.

-4

u/[deleted] Feb 24 '14

Well, to be fair, Flask-Login is really great, but just doesn't a good enough job of forcing one model of auth, which makes it really hard to use :(

so it's great but it sucks? or it's great a t sucking? Or it sucks how great it is?

3

u/rdegges Feb 24 '14

It's really great at what it does:

  • Abstracting the concept of users, so you're not dependent on a single backend (postgres, mysql, sqlalchemy, whatever).

  • Abstracting the session management.

  • Abstracting the login / logout / fetch user from cache stuff.

It's basically a nice, bare-bones framework for handling website auth.

-3

u/[deleted] Feb 24 '14

all those features listed sound fantastic and original.