fastapi_sso.sso.generic
A generic OAuth client that can be used to quickly create support for any OAuth provider with close to no code.
create_provider(*, name='generic', default_scope=None, discovery_document, response_convertor=None)
A factory to create a generic OAuth client usable with almost any OAuth provider. Returns a class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Name of the provider |
'generic'
|
default_scope |
Optional[List[str]]
|
default list of scopes (can be overriden in constructor) |
None
|
discovery_document |
Union[DiscoveryDocument, Callable[[SSOBase], DiscoveryDocument]]
|
a dictionary containing discovery document or a callable returning it |
required |
response_convertor |
Optional[Callable[[Dict[str, Any], Optional[AsyncClient]], OpenID]]
|
a callable that will receive JSON response from the userinfo endpoint and should return OpenID object |
None
|