Skip to content

Commit

Permalink
feat(discord): support action=reauthenticate
Browse files Browse the repository at this point in the history
  • Loading branch information
beheh authored and pennersr committed Jan 24, 2025
1 parent ad5a248 commit 952fd63
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion allauth/socialaccount/providers/discord/provider.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from allauth.account.models import EmailAddress
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.base import AuthAction, ProviderAccount
from allauth.socialaccount.providers.discord.views import DiscordOAuth2Adapter
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider

Expand Down Expand Up @@ -86,6 +86,12 @@ def extract_common_fields(self, data):
name=data.get("username"),
)

def get_auth_params_from_request(self, request, action):
ret = super().get_auth_params_from_request(request, action)
if action == AuthAction.REAUTHENTICATE:
ret["prompt"] = "consent"
return ret

def get_default_scope(self):
return ["email", "identify"]

Expand Down
2 changes: 1 addition & 1 deletion docs/socialaccount/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ indicates how to process the social login. You can choose between
Furthermore, you can pass along an ``action`` parameter with value
``reauthenticate`` to indicate that you want the user to be re-prompted
for authentication even if they already signed in before. For now, this
is supported by Facebook, Google and Twitter only.
is supported by Facebook, Google, Twitter, and Discord only.

For Javascript based logins (e.g. when you enable the Facebook JS
SDK), you will need to make sure that the required Javascript is
Expand Down

0 comments on commit 952fd63

Please sign in to comment.