INNER CODE UNIT · Python
get_discovery_document
tomasvotava/fastapi-sso · fastapi_sso/sso/apple.py:41
async def get_discovery_document(self) -> DiscoveryDocument:
"""Get document containing handy URLs."""
return {
"authorization_endpoint": "https://appleid.apple.com/auth/authorize",
"token_endpoint": "https://appleid.apple.com/auth/token",
"userinfo_endpoint": "https://appleid.apple.com/auth/keys",
}
async def openid_from_token(self, id_token: dict, session: Optional["httpx.AsyncClient"] = None) -> OpenID:
return await self.openid_from_response(id_token, session)
async def openid_from_response(self, response: dict, session: Optional["httpx.AsyncClient"] = None) -> OpenID:
"""Return OpenID from user information provided by Apple."""
return OpenID(
id=response.get("sub"),
email=response.get("email"),
provider=self.provider,
)