Skip to content

Commit

Permalink
Gracefully fallback from session-missing situation
Browse files Browse the repository at this point in the history
This would also enable Microsoft Entra ID B2C's Edit Profile flow
  • Loading branch information
rayluo committed Jan 28, 2024
1 parent 818e64c commit 38fb304
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion identity/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.2"
__version__ = "0.3.3"
13 changes: 10 additions & 3 deletions identity/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,16 @@ def complete_log_in(self, auth_response=None):
"""
auth_flow = self._session.get(self._AUTH_FLOW, {})
if not auth_flow:
raise ValueError(
"The web page with complete_log_in() "
"MUST be visited after the web page with log_in()")
logger.warning(
"We found no prior log_in() info from current session. "
"This situation may be caused by: "
"(1) sessions were all reset due to a recent server restart, "
"in which case you can simply start afresh with a new log-in, or "
"(2) the session was stored on the file system of another server, "
"in which case you must use either a centralized session store "
"or a load balancer with sticky session (a.k.a. affinity cookie)."
)
return {} # Return a no-op for this non-actionable error
cache = self._load_cache()
if auth_response: # Auth Code flow
try:
Expand Down

0 comments on commit 38fb304

Please sign in to comment.