Search code examples
c#openidlinkedin-apiloginradius

How to get name, email or nickname from LinkedIn provider when using LoginRadius


When doing this, with the input being from LinkedIn:

LoginRadiusSDKv2.LoginRadius loginradius = new LoginRadiusSDKv2.LoginRadius("<API SECRET>");
if (loginradius.IsAuthenticated)
{
    var userprofile = loginradius.GetBasicUserProfile();

No useful data is returned, only the userprofile.ID. For the other providers I display the email address, (for twitter the userprofile.ProfileName).

What am I to display for linkedin? I could find any documentation on the LoginRadius website for this particular provider.


Solution

  • Todd - you can get basic user profile data if it's exist for that user's ID provider. Linkedin and Twitter doesn't provider Email address in the user profile data, so you have to add special check for it:

    if (userprofile.Email != null) {  }
    

    You can get more data using these parameters:

    userprofile.FirstName //first name of user
    userprofile.FullName //full name of user
    userprofile.Gender //gender of user
    userprofile.ID //ID of user on provider
    userprofile.LastName //last name of user
    userprofile.MiddleName //middle name of user  
    userprofile.NickName //nick name of user
    

    Please see this link for more documentation for ASP.net SDK: https://www.loginradius.com/developers/implementation/dot-net-websites

    Some additional info:
    To see what data exist real-time, you can view it on the PlayGround section: https://www.loginradius.com/developers/apiplayground

    Let me know if you need any other information for LoginRadius implementation.

    Thanks,
    Deepak