From 46d8be8d20b884d01cae2e10f6da46d9e2bb5581 Mon Sep 17 00:00:00 2001 From: Dominic R Date: Wed, 12 Mar 2025 14:10:41 -0400 Subject: [PATCH] souces/oauth: reddit: fix duplicate keyword auth (#13466) * wip Closes https://github.com/goauthentik/authentik/issues/13464 The issue was that the auth parameter was being passed twice: Once directly in the get_access_token call: super().get_access_token(auth=auth) And again in the parent class's get_access_token method where it sets auth=(self.get_client_id(), self.get_client_secret()) The fix: Instead of passing auth directly to get_access_token, we now add it to the request_kwargs dictionary Then we pass all the request kwargs to the parent method using **request_kwargs * wip lint --- authentik/sources/oauth/types/reddit.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/authentik/sources/oauth/types/reddit.py b/authentik/sources/oauth/types/reddit.py index c7d1e4a7dc..3afb68850a 100644 --- a/authentik/sources/oauth/types/reddit.py +++ b/authentik/sources/oauth/types/reddit.py @@ -25,8 +25,10 @@ class RedditOAuth2Client(UserprofileHeaderAuthClient): def get_access_token(self, **request_kwargs): "Fetch access token from callback request." - auth = HTTPBasicAuth(self.source.consumer_key, self.source.consumer_secret) - return super().get_access_token(auth=auth) + request_kwargs["auth"] = HTTPBasicAuth( + self.source.consumer_key, self.source.consumer_secret + ) + return super().get_access_token(**request_kwargs) class RedditOAuth2Callback(OAuthCallback):