Questions tagged [flask-login]

Flask-Login provides user session management for the python web framework Flask.

Flask-Login provides user session management for the web framework Flask. It handles the common tasks of logging in, logging out, and remembering your users' sessions over extended periods of time.

Flask-Login is not bound to any particular database system or permissions model. The only requirement is that your user objects implement a few methods, and that you provide a callback to the extension capable of loading users from their ID.

It will:

  • Store the active user’s ID in the session, and let you log them in and out easily.
  • Let you restrict views to logged-in (or logged-out) users.
  • Handle the normally-tricky “remember me” functionality.
  • Help protect your users’ sessions from being stolen by cookie thieves.
  • Possibly integrate with Flask-Principal or other authorization extensions later on.

However, it does not:

  • Impose a particular database or other storage method on you. You are entirely in charge of how the user is loaded.
  • Restrict you to using usernames and passwords, OpenIDs, or any other method of authenticating.
  • Handle permissions beyond “logged in or not.”
  • Handle user registration or account recovery.

For detailed information and examples, visit the flask-login documentation.

See also the official Github page.

879 questions
-1
votes
1 answer

Flask app user authetication using OneLogin

I am working on a Flask webapp that requires user authentication. Currently, username and passwords are stored in the database and the server side script checks the database and authenticate the user. I am trying to change this to OneLogin…
Kay
  • 695
  • 2
  • 7
  • 18
-1
votes
1 answer

Flask User Session

After authenticating a user, I am having trouble keeping a user logged in as they move through the website I have built. I have tried using cookies and sessions but I can't seem to get it to work. I am sharing my code for login where I grab data to…
-1
votes
1 answer

Importing error : flask_login

I am using flask for backend development where i need to manage user accounts. I choose flask-login pip package for it. I installed this by, pip install flask-login And imported it in code by, from flask.ext.login import LoginManager, UserMixin,…
-1
votes
1 answer

How to implement a function to flask

I am currently stuck in connecting a function into my flask web app and need so guidance on how to do so. I have made a function and (it works perfectly) that takes in a parameter and it will print out a list of items. Example of usage is…
Han
  • 101
  • 14
-1
votes
1 answer

flask database global variable

in my flask app I am using mongoDB and on the home page I have a form that is returning all the known collections in that particular database. I am asking the user to pick a collection they want to use as I will use that collection set to return all…
Max Powers
  • 845
  • 2
  • 19
  • 42
-1
votes
1 answer

Flask authentication (login page)

I'm trying to create a login page using flask and when they enter their correct credentials they will pass, but even when they enter a wrong password and username they will pass anyway! my form index.html
-1
votes
1 answer

400: bad request when using hashlib on flask login

I'm setting up some basic database hashing, but upon setup I'm receiving a 400 bad request. This is my first time using hashes and I could use some advice. I don't plan on salting the hashes. is there something I'm missing on the HTML…
Zane
  • 63
  • 8
-1
votes
2 answers

Flask-Login login_user() throws TypeError when passing a user object

I'm trying to use the Flask-Login extension to handle my user sessions but when I call the login_user(user) method it throws the following error File "app.py", line 55, in login_user login_user(user) TypeError: login_user() takes 0 positional…
empty_space
  • 75
  • 1
  • 7
-1
votes
1 answer

@login_required flask trouble. No user_loader has been installed for this LoginManager

I have created separate Blueprints for separate modules of my project. I am having trouble with @login_required decorator. I read a very similar question but it couldn't help me. The model.py file is as following: from application import db from…
Abhishek
  • 15
  • 1
  • 7
-1
votes
1 answer

How can I create SQLAlchemy tables within __init__.py?

I am working on an application to which I'd like to add a User model. Traditionally the application is started via python3 runserver.py, but I needed a mechanism for creating admins, so I added this function: def create_admin(): username =…
erip
  • 13,935
  • 9
  • 51
  • 102
-1
votes
2 answers

What do flask-login's is_authenticated and is_anonymous do?

In the documentation, is_authenticated is defined as "is_authenticated: Returns True if the user is authenticated, i.e. they have provided valid credentials. " However, I don't understand when this method is called and what its point is, ditto for…
Ivan Vegner
  • 1,407
  • 3
  • 12
  • 19
-1
votes
1 answer

Flask user management

Is there any way to check when user was last logged in and if this time period is longer then x flask will block an account? Is it possible with flask and how to handle event listener to do so?
-1
votes
1 answer

HOw to send data and file from a form using flask?

i have created a form using html and flask. where user will fill his name , address and other information , and will also upload his photo and other documents. once the user will fill the information and submits the form he will be redirected to…
ravenwingz
  • 107
  • 2
  • 10
-1
votes
1 answer

How to skip login page if token is not expire or exit in flask?

How to skip login page if there is already token exit in flask session. In def login(): I got token from auth.get_token() method. If token is exit then how I will skip login page. from flask import session def…
geeks
  • 1,833
  • 3
  • 28
  • 46
-1
votes
1 answer

Python Flask - Login - UndefinedError: 'None' has no attribute 'is_authenticated'

Am using Python , Flask-Login, The below line from a Flask html {% if current_user.is_authenticated() % throws below error in Ubuntu OS, and works fine in Windows OS(W7) File "/home/user/workspace/test/templates/layout.html", line 27, in…
user3110336
  • 243
  • 1
  • 2
  • 8
1 2 3
58
59