question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Updating to Flask 2.0 / Werkzeug 2.0 causes a deprecation warning in Flask-Login for safe_str_cmp

See original GitHub issue

Describe 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:

  1. Install Flask 2.0 / Werkzeug 2.0
  2. Install Flask-Login 0.5.0
  3. Use Flask-Login as per the guide’s recommendation
  4. 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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
le717commented, Jul 29, 2021

This has been fixed by #585 and can be closed. 😄

1reaction
nickjjcommented, May 12, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found