Skip to content

Commit

Permalink
fix(socialaccount): fix issue pennersr#3599
Browse files Browse the repository at this point in the history
fix issue pennersr#3599 by checking before a token update if app instance is saved to database. If not set app instance to None.
  • Loading branch information
miqsoft committed Jan 18, 2024
1 parent 3064115 commit fe32e39
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions allauth/socialaccount/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,11 @@ def _lookup_by_socialaccount(self):
# Update token
if app_settings.STORE_TOKENS and self.token:
assert not self.token.pk
# check if app does exist in database if not set self.token.app to None
try:
SocialApp.objects.get(id=self.token.app.id)
except SocialApp.DoesNotExist:
self.token.app = None
try:
t = SocialToken.objects.get(
account=self.account, app=self.token.app
Expand Down

0 comments on commit fe32e39

Please sign in to comment.