Updating to Flask 2.0 / Werkzeug 2.0 causes a deprecation warning in Flask-Login for safe_str_cmp
See original GitHub issueDescribe the bug
Updating to Flask 2.0 / Werkzeug 2.0 causes a deprecation warning for safe_str_cmp
’s import path.
To Reproduce
Steps to reproduce the behavior:
- Install Flask 2.0 / Werkzeug 2.0
- Install Flask-Login 0.5.0
- Use Flask-Login as per the guide’s recommendation
- See the following warning:
python3.9/site-packages/flask_login/utils.py:63: DeprecationWarning: 'safe_str_cmp' is deprecated and will be removed in Werkzeug 2.1. Use 'hmac.compare_digest' instead.
if safe_str_cmp(_cookie_digest(payload, key=key), digest):
Expected behavior
No warnings.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Fix Flask 2.0 Warnings in Flask-Login, Flask-WTF ... - YouTube
We'll go over 3 pull requests I created in each library to fix a few deprecation warnings.Hit the subscribe button to receive more...
Read more >How to Fix: Cannot import safe_str_cmp from Werkzeug - Blog
This page explains how to fix "ImportError: cannot import name 'safe_str_cmp' from werkzeug.security" caused by the latest Werkzeug version - v2 ...
Read more >Changes — Flask Documentation (2.2.x)
Update Werkzeug dependency to >= 2.2.2. This includes fixes related to the new faster router, header parsing, and the development server.
Read more >Flask-Security Documentation
Installing Flask -Security-Too using: ... from werkzeug.middleware.proxy_fix import ProxyFix ... It has been deprecated since 2.0.2.
Read more >Fix Flask 2.0 Warnings in Flask-Login, Flask-WTF & Flask ...
In this video we'll go over 3 pull requests that fix a few deprecation warnings in 3 popular Flask extensions.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This has been fixed by #585 and can be closed. 😄
Ok, I opened a PR at https://github.com/maxcountryman/flask-login/pull/585. I didn’t run the test suite locally, but let’s see how straightforward this change is haha.