httpx-oauth
httpx-oauth copied to clipboard
Support custom authorization server for OKTA client
OKTA allows to define custom authorization server instead of using the organization authorization server. This is a usual practice when your OKTA server has to support the authorization process of several applications.
The .well-know URL has a different format for those servers. It would be nice to support them as well.
I have unfortunately no time to make a proper pull request. But here would be the code to implement this little change adding a 'auth_Server_id' parameter to the constructoR..
class OktaOAuth2(OpenID):
def __init__(
self,
client_id: str,
client_secret: str,
okta_domain: str,
auth_server_id: Optional[str] = None,
scopes: Optional[List[str]] = BASE_SCOPES,
name: str = "okta",
):
well_known_url = f"https://{okta_domain}/.well-known/openid-configuration" if auth_server_id is None \
else f"https://{okta_domain}/oauth2/{auth_server_id}/.well-known/openid-configuration"
super().__init__(
client_id,
client_secret,
well_known_url,
name=name,
base_scopes=scopes,
)