Byndyusoft.Net.YandexAuth 0.0.2

dotnet add package Byndyusoft.Net.YandexAuth --version 0.0.2                
NuGet\Install-Package Byndyusoft.Net.YandexAuth -Version 0.0.2                
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="Byndyusoft.Net.YandexAuth" Version="0.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Byndyusoft.Net.YandexAuth --version 0.0.2                
#r "nuget: Byndyusoft.Net.YandexAuth, 0.0.2"                
#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 Byndyusoft.Net.YandexAuth as a Cake Addin
#addin nuget:?package=Byndyusoft.Net.YandexAuth&version=0.0.2

// Install Byndyusoft.Net.YandexAuth as a Cake Tool
#tool nuget:?package=Byndyusoft.Net.YandexAuth&version=0.0.2                

License

Byndyusoft.Net.YandexAuth NugetDownloads

The package contains an implementation for authentication and authorization with the Yandex ID service. The implemented service is capable of:

  • Creating a redirection link for the user to authenticate with Yandex ID.
  • Retrieving user authentication data based on the code from the service.
  • Retrieving authentication data based on a refresh token.
  • Retrieving user data from the Yandex ID system.

Installing

dotnet add package Byndyusoft.Net.YandexAuth

Usage

  • To use this package, first add the Yandex ID service parameters to the configuration:
"YandexIdOptions": {
       "ClientId": "<your client id>",
       "ClientSecret": "<your client secret>"
   }

More details on registering the application and obtaining these parameters can be found at the provided link.

  • Register the service for working with Yandex ID in the ConfigureServices method:
   // IServiceCollection
   services.AddYandexAuthorization(Configuration);
  • Retrieving service from DI.
public class MyClass
{
    private readonly IYandexAuthService _yandexAuthService;

    public MyClass(IYandexAuthService service)
    {
        _yandexAuthService = service;
    }
}
  • Generate a link for user authentication in the Yandex ID service (documentation): In this implementation, the "redirect_uri" and "state" fields are used to create the link.
var redirectLink = _yandexAuthService.GetYandexAuthLink("<your-application-page-link>", "optional parameters");
  • Obtain user authentication data based on the code.
    var authenticateDataResult = await _yandexAuthService.GetAuthenticationDataByCodeAsync("<code-from-yandex-id>", cancellationToken);
  • Obtain user authentication data based on the refresh token.
    var authenticateData = await _yandexAuthService.GetAuthenticationDataByRefreshTokenAsync("<yandex-id-refresh-token>", cancellationToken);
  • Retrieve user data from the Yandex ID service.
    var yandexUserInfoResult = await _yandexAuthService.GetUserInfo("<yandex-id-access-token>", cancellationToken);

Contributing

To contribute, you will need to setup your local environment, see prerequisites. For the contribution and workflow guide, see package development lifecycle.

Prerequisites

Make sure you have installed all of the following prerequisites on your development machine:

Package development lifecycle

  • Implement package logic in src
  • Add or change the documentation as needed
  • Open pull request in the correct branch. Target the project's master branch

Maintainers

github.maintain@byndyusoft.com

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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
0.0.2 647 5/7/2024
0.0.1 980 11/29/2023
0.0.1-tags-1.0.0 82 11/24/2023