Crv5heR.OAuth.Google 1.0.1

dotnet add package Crv5heR.OAuth.Google --version 1.0.1
NuGet\Install-Package Crv5heR.OAuth.Google -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Crv5heR.OAuth.Google" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Crv5heR.OAuth.Google --version 1.0.1
#r "nuget: Crv5heR.OAuth.Google, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Crv5heR.OAuth.Google as a Cake Addin
#addin nuget:?package=Crv5heR.OAuth.Google&version=1.0.1

// Install Crv5heR.OAuth.Google as a Cake Tool
#tool nuget:?package=Crv5heR.OAuth.Google&version=1.0.1

YAGOA

Yet another Google OAuth Library

YAGOA is a .NET Library that consumes the Google OAuth API to retrieve the authorized user data for the backend to process

You can use it to validate the user email and info when creating a new account or logging in.

of course you'll need to authenticate on the Frontend side to retrieve to Google Bearer Token

I suggest using react-oauth by MomenSherif on the frontend side.

Usage

You can simply use this library by creating an instance of GoogleService and call AuthenticateAsync():

GoogleService googleService = new GoogleService();

GoogleAuthRequest googleAuthRequest = new GoogleAuthRequest
{
    Token = "YOUR_GOOGLE_ACCESS_TOKEN"
};

GoogleAuthResponse googleAuthResponse =
    await googleService.AuthenticateAsync(googleAuthRequest);

GoogleAuthResponse will return the following data:

  • Name
  • GivenName (First Name)
  • FamilyName (Last Name)
  • Email
  • Picture (Picture URL)
  • HostedDomain (User's Organization Domain)
  • Locale

Expectations

  • The Token property in GoogleAuthRequest is the Bearer Token that you get from the frontend
  • The GoogleAuthResponse will contain the user's data if the token is valid

Packages that I used

Why I Made This

The main reason Is to simplify my work process by reusing the same code every time for SSO Authentication

Contributing

I welcome any sort of contribution, Please use The-Standard.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 91 2/25/2024
1.0.0 93 2/24/2024