Skip to main content
Login Register
Code2night
  • Home
  • Blog Archive
  • Learn
    • Tutorials
    • Videos
  • Interview Q&A
  • Resources
    • Cheatsheets
    • Tech Comparisons
  • Languages
    • Angular Angular js ASP.NET Asp.net Core ASP.NET Core, C# ASP.NET MVC ASP.NET Web Forms C C# C#, ASP.NET Core, Dapper
      C#, ASP.NET Core, Dapper, Entity Framework DotNet General Web Development HTML, CSS HTML/CSS Java JavaScript JavaScript, HTML, CSS JavaScript, Node.js Node.js
      Python Python 3.11, Pandas, SQL Python 3.11, SQL Python 3.11, SQLAlchemy Python 3.11, SQLAlchemy, SQL Python 3.11, SQLite React Security SQL Server TypeScript
  • Post Blog
  • Tools
    • Beautifiers
      JSON Beautifier HTML Beautifier XML Beautifier CSS Beautifier JS Beautifier SQL Formatter
      Dev Utilities
      JWT Decoder Regex Tester Diff Checker Cron Explainer String Escape Hash Generator Password Generator
      Converters
      Base64 Encode/Decode URL Encoder/Decoder JSON to CSV CSV to JSON JSON to TypeScript Markdown to HTML Number Base Converter Timestamp Converter Case Converter
      Generators
      UUID / GUID Generator Lorem Ipsum QR Code Generator Meta Tag Generator
      Image Tools
      Image Converter Image Resizer Image Compressor Image to Base64 PNG to ICO Background Remover Color Picker
      Text & Content
      Word Counter PDF Editor
      SEO & Web
      SEO Analyzer URL Checker World Clock
  1. Home
  2. Blog
  3. ASP.NET MVC
  4. Linkedin Sign In using LinkedinLogin Nuget package in Asp-Net MVC

Linkedin Sign In using LinkedinLogin Nuget package in Asp-Net MVC

Date- Jul 05,2022 Updated Mar 2026 8846 Free Download Pay & Download
LinkedinLogin LinkedinProfile

Hello guys and welcome to Code2Night! In this article, we'll take a look at how to integrate the Linkedin Sign In functionality using the LinkedinLogin Nuget package in an Asp-Net MVC application.  We'll cover everything you need to know to get up and running with this powerful authentication method, so let's get started!

Web developers are probably well aware of the requirement to integrate social logins into their applications. Users expect to be able to check in with their preferred platforms thanks to the growth of social media, rather than having to create yet another login and password. This enhances the user experience while also making it easier for developers to authenticate users.

One social login that has become increasingly popular is the Linkedin Login. With millions of professionals on the platform, it's a great option for applications targeting the business or career-oriented demographic.

 

Install-Package from Nuget Package Manager

So, we will be using a Nuget package that is used for linkedin login in two easy steps and is quite simple. So first of all you have to install the Nuget package that is shown in the image. 

Nuget Package


You can also install this Nuget package using the command in the package manager console

 Install-Package LinkedinLogin -Version 1.0.0

After you have successfully installed the LinkedinLogin page. You have to go to the controller and add code to your controller.

Now this method will return you the redirect URL which you have to add in your button href on view and on clicking that button it will redirect to the LinkedIn login screen. So we will be storing the information in ViewBag and passing that on to the view. So first do this on the controller side on the action which is fired when the page is loaded.

        public ActionResult Index()
        {
            ViewBag.uri = LinkedinLogin.LinkedinPackage.RedirectToLinkedinLoginUrl("ClientId", "redirectUri");
            ViewBag.url = LinkedinLogin.LinkedinPackage.RedirectToLinkedinLoginUrl("7710pzauu34u5oni12cxsabc", "http://localhost:8080/Home/RedirectLinkedIN");
            return View();
        }

Now, we will add another action method which is the redirect method which we will redirect after you enter your LinkedIn id and password on the LinkedIn login screen and authentication is successful. then it will redirect to the method. You have to pass the URL of this method in redirect uri as a parameter. This must also be added when creating LinkedIn client id and client secret key.

        public ActionResult RedirectLinkedIN(string code)
        {
            try
            {
                var results = LinkedinLogin.LinkedinPackage.GetLinkedinUserProfile(code, "clientId", "clientSecet", "redirectUri");
                var result = LinkedinLogin.LinkedinPackage.GetLinkedinUserProfile(code, "7710pzu5onereeicxs", "xUvKfIranere45Z0KDa50", "http://localhost:8080/Home/RedirectLinkedIN");
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return View();
        }

Now, the URL that we set in the viewing in the first step will be used like this on the view. When you will click on this anchor button it will redirect to the LinkedIn Login screen where you will authenticate your user.

 @{
    ViewBag.Title = "Home Page";
}
<a style="margin-top:10px" href="@ViewBag.url"
   class="btn btn-primary"> Hureee!Login with LinkedIN</a>

Now, run the application and you will see this button. Click on this button

Linkedin Sign In using LinkedinLogin Nuget package in Asp-Net MVC

You will see this screen on redirect. You can also face an error if Redirect URI in the app doesn't match the one passed in the code. If everything is fine you will see this screen. Enter the details and click on Sign in.

Linkedin Sign In using LinkedinLogin Nuget package in Asp-Net MVC 2

Now, it will redirect to the method which we have passed inside the redirect URI. Here you will get the Code parameter in the request sent by LinkedIn.This code will be passed in our second method along with the client id, client secret, and redirect URI. In the result, you can see the LinkedIn profile returned for the logged-in user.

Linkedin Sign In using LinkedinLogin Nuget package in Asp-Net MVC 3So this is how you can integrate Linkedin Sign In using the LinkedinLogin Nuget package in Asp-Net MVC. If you face any issue you can comment on the article.

S
Shubham Batra
Programming author at Code2Night — sharing tutorials on ASP.NET, C#, and more.
View all posts →

Related Articles

Linkedin Sign In using LinkedinLogin Nuget package in Asp-Net MVC
Apr 14, 2023
Implement Facebook Login in Asp.Net MVC
Apr 18, 2023
Excel Export in Asp.Net MVC using XlWorkbook
Jun 11, 2022
How to export view as pdf in Asp.Net Core
Jul 05, 2022
Previous in ASP.NET MVC
Implement Stripe Payment Gateway In ASP.NET MVC
Next in ASP.NET MVC
Image Compression in Asp.net MVC
Buy me a pizza

Comments

🔥 Trending This Month

  • 1
    HTTP Error 500.32 Failed to load ASP NET Core runtime 6,933 views
  • 2
    Error-An error occurred while processing your request in .… 11,269 views
  • 3
    Comprehensive Guide to Error Handling in Express.js 233 views
  • 4
    ConfigurationBuilder does not contain a definition for Set… 19,458 views
  • 5
    Mastering JavaScript Error Handling with Try, Catch, and F… 160 views
  • 6
    Mastering Unconditional Statements in C: A Complete Guide … 21,491 views
  • 7
    Unable to connect to any of the specified MySQL hosts 6,225 views

On this page

🎯

Interview Prep

Ace your ASP.NET MVC interview with curated Q&As for all levels.

View ASP.NET MVC Interview Q&As

More in ASP.NET MVC

  • Implement Stripe Payment Gateway In ASP.NET 58741 views
  • Jquery Full Calender Integrated With ASP.NET 39653 views
  • Microsoft Outlook Add Appointment and Get Appointment using … 27579 views
  • How to implement JWT Token Authentication and Validate JWT T… 25283 views
  • Payumoney Integration With Asp.Net MVC 23226 views
View all ASP.NET MVC posts →

Tags

AspNet C# programming AspNet MVC c programming AspNet Core C software development tutorial MVC memory management Paypal coding coding best practices data structures programming tutorial tutorials object oriented programming Slick Slider StripeNet
Free Download for Youtube Subscribers!

First click on Subscribe Now and then subscribe the channel and come back here.
Then Click on "Verify and Download" button for download link

Subscribe Now | 1770
Download
Support Us....!

Please Subscribe to support us

Thank you for Downloading....!

Please Subscribe to support us

Continue with Downloading
Be a Member
Join Us On Whatsapp
Code2Night

A community platform for sharing programming knowledge, tutorials, and blogs. Learn, write, and grow with developers worldwide.

Panipat, Haryana, India
info@code2night.com
Quick Links
  • Home
  • Blog Archive
  • Tutorials
  • About Us
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Guest Posts
  • SEO Analyzer
Dev Tools
  • JSON Beautifier
  • HTML Beautifier
  • CSS Beautifier
  • JS Beautifier
  • SQL Formatter
  • Diff Checker
  • Regex Tester
  • Markdown to HTML
  • Word Counter
More Tools
  • Password Generator
  • QR Code Generator
  • Hash Generator
  • Base64 Encoder
  • JWT Decoder
  • UUID Generator
  • Image Converter
  • PNG to ICO
  • SEO Analyzer
By Language
  • Angular
  • Angular js
  • ASP.NET
  • Asp.net Core
  • ASP.NET Core, C#
  • ASP.NET MVC
  • ASP.NET Web Forms
  • C
  • C#
  • C#, ASP.NET Core, Dapper
  • C#, ASP.NET Core, Dapper, Entity Framework
  • DotNet
  • General Web Development
  • HTML, CSS
  • HTML/CSS
  • Java
  • JavaScript
  • JavaScript, HTML, CSS
  • JavaScript, Node.js
  • Node.js
  • Python
  • Python 3.11, Pandas, SQL
  • Python 3.11, SQL
  • Python 3.11, SQLAlchemy
  • Python 3.11, SQLAlchemy, SQL
  • Python 3.11, SQLite
  • React
  • Security
  • SQL Server
  • TypeScript
© 2026 Code2Night. All Rights Reserved.
Made with for developers  |  Privacy  ·  Terms
Translate Page
We use cookies to improve your experience and analyze site traffic. By clicking Accept, you consent to our use of cookies. Privacy Policy
Accessibility
Text size
High contrast
Grayscale
Dyslexia font
Highlight links
Pause animations
Large cursor