diff --git a/fastapi_sso/sso/naver.py b/fastapi_sso/sso/naver.py index 5cc46c9..c4a4c87 100644 --- a/fastapi_sso/sso/naver.py +++ b/fastapi_sso/sso/naver.py @@ -25,7 +25,8 @@ async def get_discovery_document(self) -> DiscoveryDocument: async def openid_from_response(self, response: dict, session: Optional["httpx.AsyncClient"] = None) -> OpenID: return OpenID( id=response["response"]["id"], - display_name=response["response"]["nickname"], - picture=response["response"]["profile_image"] or None, + email=response["response"].get("email"), + display_name=response["response"].get("nickname"), + picture=response["response"].get("profile_image"), provider=self.provider, ) diff --git a/tests/test_openid_responses.py b/tests/test_openid_responses.py index 2c151ea..dd58b0b 100644 --- a/tests/test_openid_responses.py +++ b/tests/test_openid_responses.py @@ -30,8 +30,8 @@ ), ( NaverSSO, - {"response": {"nickname": "test", "profile_image": "https://myimage", "id": "test"}}, - OpenID(id="test", display_name="test", provider="naver", picture="https://myimage"), + {"response": {"nickname": "test", "profile_image": "https://myimage", "id": "test", "email": "test@example.com"}}, + OpenID(id="test", email="test@example.com", display_name="test", provider="naver", picture="https://myimage"), ), ( MicrosoftSSO,