Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Utility to retrieve access token from OAuth2.0 Server or Security Token Service (STS) using Client Credentials grant type.

NotificationsYou must be signed in to change notification settings

ankushjain358/OAuth2.ClientCredentials

Repository files navigation

Identity.OAuth2.ClientCredentials is a utility to retrieve access token from OAuth2.0 Server or Security Token Service (STS) using Client Credentials grant type.

The implementation is done using .NET Standard, so NuGet package supports both .NET Framework and .NET Core applications.

Features

  • Easy setup
  • Access Token caching
  • Auto renewal upon expiry

Getting Started

  1. Install the standard Nuget package into your application.
Install-Package Identity.OAuth2.ClientCredentials -Version 1.0.0
  1. Import proper namespace
using OAuth2.ClientCredentials;
  1. Use below code to retrieve Access Token
// 1. Declare pre-requisitesstring tokenEndpoint = "https://security-token-service.com/oauth2/v1/token";string clientId = "your_client_id";string clientSecret = "your_client_secret";// 2. Create AuthRequest objectAuthRequest authRequest = new AuthRequest(clientId, clientSecret);// 3. Create ClientCredential objectClientCredential defaultClientCredential = new ClientCredential(tokenEndpoint, authRequest);// 4. Obtain access token in auth response AuthResponse authResponse = defaultClientCredential.GetToken().Result;// 5. Use the tokenConsole.WriteLine("Token: " + authResponse.AccessToken);

Thank You !!

About

Utility to retrieve access token from OAuth2.0 Server or Security Token Service (STS) using Client Credentials grant type.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp