K
Kinde5mo ago
tom

Client Credentials with Python SDK

When using OAuth Client Credentials flow, does the Python SDK provide a function to verify and decode the bearer authorization header?
2 Replies
onderay
onderay5mo ago
The Python SDK for Kinde does provide functionality related to OAuth and token handling as we designed it be agonistic so any framework would work, we are in the process of updating the SDK to improved. You could install your preferred JWT verification. However, the SDK does offer methods for token introspection and user profile retrieval, which might be helpful for your use case. For example, you can use the token_introspection method to get details about a token: Token Introspection
api_instance = o_auth_api.OAuthApi(api_client)
body = dict(
token="token_example",
token_type="token_type_example",
)
try:
api_instance = o_auth_api.OAuthApi(api_client)
body = dict(
token="token_example",
token_type="token_type_example",
)
try:
Get token details
api_response = api_instance.token_introspection(
body=body,
)
pprint(api_response)
except kinde_sdk.ApiException as e:
print("Exception when calling OAuthApi->token_introspection: %s\n" % e)
Additionally, you can retrieve user profile information using the get_user_profile_v2 method:
api_response = api_instance.token_introspection(
body=body,
)
pprint(api_response)
except kinde_sdk.ApiException as e:
print("Exception when calling OAuthApi->token_introspection: %s\n" % e)
Additionally, you can retrieve user profile information using the get_user_profile_v2 method:
Get User Profile
api_instance = o_auth_api.OAuthApi(api_client)
try:
api_instance = o_auth_api.OAuthApi(api_client)
try:
Returns the details of the currently logged in user
api_response = api_instance.get_user_profile_v2()
pprint(api_response)
except kinde_sdk.ApiException as e:
print("Exception when calling OAuthApi->get_user_profile_v2: %s\n" % e)
api_response = api_instance.get_user_profile_v2()
pprint(api_response)
except kinde_sdk.ApiException as e:
print("Exception when calling OAuthApi->get_user_profile_v2: %s\n" % e)
These methods might help you verify the token and retrieve user information, but they don't specifically address decoding the bearer authorization header.
tom
tomOP5mo ago
thanks Andre, I will try that.
Want results from more Discord servers?
Add your server