getting back empty user info from await sso.verify_and_process(request)
markmjm opened this issue · 3 comments
markmjm commented
Hello
I am using the generic option. I am seeing this warning:
fastapi_sso.sso.generic - WARNING - No response convertor was provided, returned OpenID will always be empty
from this call.
a_user = await sso.verify_and_process(request)
return {
"id": a_user.id,
"picture": a_user.picture,
"display_name": a_user.display_name,
"email": a_user.email,
"provider": a_user.provider
}
please advise how to implement the response converter.
Thank you
tomasvotava commented
The response convertor is a callable accepting the response content (most probably a dictionary) and returning OpenID
object. If your userinfo endpoint returns something like this:
{
"id": 1,
"name": "ijustfarted",
"email": "ijustfarted@you.com",
"picture": "https://unsplash.it/200"
}
Your convertor will look like this:
def openid_convertor(response: Dict[str, Any]) -> OpenID:
return OpenID(
id=response["id"],
email=response["email"],
display_name=response["name"],
picture=response["picture"]
)
Is this understandable enough? If so, I will mention this issue in the docs.
If you have any more questions, please let me know.
tomasvotava commented
Closed the issue by mistake, sorry. It's open again. Let me know if I can close it.
tomasvotava commented
Closing for inactivity 👌