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.
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)
- Picture (Picture URL)
- HostedDomain (User's Organization Domain)
- Locale
- The
Token
property inGoogleAuthRequest
is the Bearer Token that you get from the frontend - The
GoogleAuthResponse
will contain the user's data if the token is valid
The main reason Is to simplify my work process by reusing the same code every time for SSO Authentication
I welcome any sort of contribution, Please use The-Standard.