Share

Less boilerplate, more building: A NuGet package to simplify OAuth-based social login for developers.

Do you remember when logging into software always meant typing an email and password? Today, authentication is smoother thanks to OAuth-based social logins. Google, GitHub, Facebook – users expect them everywhere!

At AIT, we build software every day, and almost every product requires social login integration. Over time, that meant writing the same OAuth flows again and again – sometimes slightly differently, sometimes entirely rewritten – across projects, teams, and .NET versions.

Repetition at this scale isn’t harmless. It slows teams down, introduces inconsistencies, and increases the surface area for bugs.

So we did what engineers do best: we automated it.

In the second edition of our NuGet Nuggets series, we’re sharing how we built a lightweight, extensible NuGet package to standardize social login integration across our .NET projects.

Not a blog type of person? Watch a video about it instead!

The problem: Repetition without standardization

Social login was not new to our teams. But more experience means noticing more patterns that can improve.

Over the years, we noticed several recurring issues:

  • No shared standard: Each developer implemented OAuth slightly differently.
  • Maintenance overhead: .NET version upgrades often required manual refactoring.
  • Redundant effort: Similar code was rewritten or copied across projects.
  • Higher risk of bugs: Manual OAuth handling left room for subtle errors.

Individually, these issues seemed manageable. At scale, they weren’t.

We needed a reusable solution – something opinionated enough to standardize, but flexible enough to adapt. Here’s what we came up with!

The solution: A lightweight social login NuGet package

One of our senior engineers took the initiative to build a reusable .NET library, later published as a NuGet package named Social Login.

The goal was simple:

Provide a clean, minimal abstraction over OAuth flows that developers can plug into projects with minimal configuration.

What the package includes

The package currently supports:

  • Google, GitHub, and Facebook login
  • OAuth 2.0 authentication flow handling
  • Secure token exchange and refresh
  • User profile and email retrieval
  • Minimal setup with extensibility in mind


Instead of re-implementing OAuth logic, developers now work with consistent client interfaces and predictable behavior across projects.

Under the hood: How the package is structured

The library is written in C# and exposes provider-specific clients, each responsible for handling its OAuth lifecycle.

Google OAuth

Handles Google authentication and profile access using OAuth 2.0. It supports:

  • Generating login URLs
  • Exchanging authorization codes for access tokens
  • Refreshing and revoking tokens
  • Retrieving authenticated user profile data

GitHub OAuth

Provides GitHub-based authentication and user data access. It enables:

  • OAuth login flow handling
  • Secure token exchange
  • Fetching user profile and email information

Facebook OAuth

Manages Facebook authentication and basic profile retrieval. It includes:

  • OAuth login flow handling
  • Access token exchange
  • User profile data access
Each provider follows OAuth 2.0, but with subtle differences in implementation. This package normalizes those differences so developers can integrate social login without dealing directly with provider-specific quirks or boilerplate code.

Third-party packages vs. Social Login

Third-Party Packages

Social Login

Feature-heavy and opinionated

Lightweight and focused

Generic use cases

Built from real production needs

Limited control over internals

Full ownership and extensibility

Overkill for simple flows

Minimal, predictable API

Impact on Developer Workflow

Once adopted internally, the benefits were immediate:

  • Faster social login implementation
  • Consistent authentication behavior across projects
  • Easier upgrades and maintenance
  • Less boilerplate, fewer bugs
  • More time spent on product logic instead of plumbing
The biggest win wasn’t lines of code saved. It was the mental overhead eliminated.

Using Social Login in your projects

The Social Login package is available for anyone to download here: https://www.nuget.org/packages/AsthaIT.SocialLogin. All instructions are available in the link as well as the code snippet.

This library may look small on the surface. But at the scale we operate, it replaced a recurring source of friction with a clean, reusable solution. It has created a big impact on our efficiency and made the work we do more meaningful.

We look forward to sharing more resources like this with you so that we can grow together and be more productive – one step at a time!

Want more of our NuGet Nuggets? Read the first edition!

Latest from Our Blog

Your-AI-agent-does-not-need-a-smarter-model
AIT--Blog-feature-Image-update
AIT-Partners-with-BANCAT-to-Support-Cancer-Patients-Through-Mosabbir-Alok-Nibash
Will-AI-replace-developers

Recommended for You

Your-AI-agent-does-not-need-a-smarter-model
AIT--Blog-feature-Image-update
Will-AI-replace-developers
The-death-of-the-loading-spinner
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.