-
-
Notifications
You must be signed in to change notification settings - Fork 569
Open
Labels
Description
Expected behaviour
There should be a single place to create HTTP authentication headers from KEY / SECRET.
Actual behaviour
There seem to be at least 7 implementations of this.
What are the steps to reproduce this issue?
Look around the code for code blocks like:
social-core/social_core/backends/chatwork.py
Lines 27 to 31 in 3d95a29
def auth_headers(self): | |
return { | |
"Authorization": b"Basic " | |
+ base64.b64encode("{}:{}".format(*self.get_key_and_secret()).encode()) | |
} |
social-core/social_core/backends/beats.py
Lines 24 to 31 in 3d95a29
def auth_headers(self): | |
return { | |
"Authorization": "Basic {}".format( | |
base64.urlsafe_b64encode( | |
"{}:{}".format(*self.get_key_and_secret()).encode() | |
) | |
) | |
} |
Any other comments?
Probably the base class should get something like get_key_and_secret_basic_auth and it should be used in subclasses. Maybe even there could be a BaseOAuth2
subclass implementing auth_headers
this way.