Python Flask Tutorial: Full-Featured Web App Part 6 - User Authentication
Why Stack Overflow recommends it
Stack Overflow users cite it as the tutorial they were following when they hit bugs with Flask login, redirects and flask-login imports, and answerers use it as context for reproducing those problems.
Recommended by 0 people across 0 different months, 2020 to 2023.
What it is
Part 6 of Corey Schafer's Flask blog series, a roughly 47 minute tutorial on adding user authentication. He builds user registration, password hashing with flask-bcrypt, and login and logout using flask-login.
What people said
Cites lgTakunda · 2020-02 · Stack Overflow · on “Flask error on redirect: TypeError: __init__() takes from 1 to 2 positional arguments but 3 were given”
I'm a newbie in flask and I'm learning it following a tutorial on youtube [this video] . If I run the following code it and go to the browser, it is working well but the error comes whenever I would want the web page to redirect. The code is as follows: from flask import Flask, render_template, url_for, flash, redirect from forms import RegistrationForm, LoginForm app = Flask(__name__) app.config['SECRET_KEY'] = '765bb2ad427608c76640cbec522eb8c2' posts = [ { 'author': 'Takunda Mafuta', 'title': 'Blog Post 1', 'content': 'Content 1', 'date_posted': '19 Jan 2020' }, { 'author': 'Thelma Mafuta', 'title': 'Blog Post 2', 'content': 'Content 2', 'date_posted': '18 Jan 2020' } ] @app.route('/') @app.rou
Cites Anish Rayaprolu · 2021-04 · Stack Overflow · on “flask-login current_user.is_authenticated always is False”
I've been following along and practicing how to create a flask webpage by Corey Schafer's youtube tutorials and I'm stuck trying to create the logout button, I've tried this many times and have found out that the problem lies in current_user.is_authenticated Here's my routes.py code for the login and logout (I'm including the imports): from flask import render_template, url_for, flash, redirect, request from flaskblog import app, db, bcrypt from flaskblog.forms import RegistrationForm, LoginForm from flaskblog.models import User, Post from flask_login import login_user, current_user, logout_user, login_required @app.route("/login", methods=['GET', 'POST']) def login(): if current_user.is_aut
Cites Nicholas White · 2023-10 · Stack Overflow · on “ImportError: cannot import name 'url_decode' from 'werkzeug.urls'”
Not an answer, but context: The OP was following a Flask tutorial on YouTube, "Python Flask Tutorial: Full-Featured Web App Part 6 - User Authentication" [this video] . I believe the tutorial was written in 2017/2018, and today is Oct 2023. The OP was having a problem authenticating users right after doing a PIP install of flask_login . I had the same problem and was direct to this post after doing a search of the error ImportError: cannot import name 'url_decode' from 'werkzeug.urls' I was able to get around the problem by uninstallig the existing version of werkzeug , followed by installing an older version of werkzeug . $ pip uninstall werkzeug $ pip install werkzeug==2.3.0