Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linkedin thirdparty provider does not set raw_user_info_from_provider in get_user_info #548

Open
humamamouri opened this issue Dec 1, 2024 · 0 comments

Comments

@humamamouri
Copy link

This is an issue similar to the one created for Github thrid party provider #474. I noticed that we are recieving user info from linkedin but it is not being passed so it cannot be accessed when overriding thridparty functions.

Below code is from the file linkedin.py from the latest python SDK 0.26.1 and you can see that only third_party_user_id and email are being returned.

class LinkedinImpl(GenericProvider):
  
  ...

    async def get_user_info(
        self, oauth_tokens: Dict[str, Any], user_context: Dict[str, Any]
    ) -> UserInfo:
        access_token: Union[str, None] = oauth_tokens.get("access_token")

        if access_token is None:
            raise Exception("Access token not found")

        headers = {
            "Authorization": f"Bearer {access_token}",
        }

        raw_user_info_from_provider = RawUserInfoFromProvider({}, {})
        # https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2?context=linkedin%2Fconsumer%2Fcontext#sample-api-response
        user_info = await do_get_request(
            "https://api.linkedin.com/v2/userinfo", headers=headers
        )
        raw_user_info_from_provider.from_user_info_api = user_info

        return UserInfo(
            third_party_user_id=raw_user_info_from_provider.from_user_info_api.get("sub"),  # type: ignore
            email=UserInfoEmail(
                email=raw_user_info_from_provider.from_user_info_api.get("email"),  # type: ignore
                is_verified=raw_user_info_from_provider.from_user_info_api.get("email_verified"),  # type: ignore
            ),
        )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant