Skip to content

Linkedin thirdparty provider does not set raw_user_info_from_provider in get_user_info #548

@humamamouri

Description

@humamamouri

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
            ),
        )

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy