Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix encode_client_secret_basic to match RFC 6749 #594

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion authlib/oauth2/auth.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import base64
from urllib.parse import quote
from authlib.common.urls import add_params_to_qs, add_params_to_uri
from authlib.common.encoding import to_bytes, to_native
from .rfc6749 import OAuth2Token
from .rfc6750 import add_bearer_token


def encode_client_secret_basic(client, method, uri, headers, body):
text = f'{client.client_id}:{client.client_secret}'
text = f'{quote(client.client_id)}:{quote(client.client_secret)}'
auth = to_native(base64.b64encode(to_bytes(text, 'latin1')))
headers['Authorization'] = f'Basic {auth}'
return uri, headers, body
Expand Down
Loading