Soenneker.Google.Credentials 11.0.2662

Prefix Reserved
dotnet add package Soenneker.Google.Credentials --version 11.0.2662
                    
NuGet\Install-Package Soenneker.Google.Credentials -Version 11.0.2662
                    
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="Soenneker.Google.Credentials" Version="11.0.2662" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Google.Credentials" Version="11.0.2662" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Google.Credentials" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Google.Credentials --version 11.0.2662
                    
#r "nuget: Soenneker.Google.Credentials, 11.0.2662"
                    
#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.
#:package Soenneker.Google.Credentials@11.0.2662
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Google.Credentials&version=11.0.2662
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Google.Credentials&version=11.0.2662
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Google.Credentials

Loads Google service-account JSON files from an application's output directory and caches scoped credentials for reuse.

Install

dotnet add package Soenneker.Google.Credentials

Add the credential file

Keep the service-account JSON outside source control and copy it to LocalResources in the application output:

<ItemGroup>
  <Content Include="LocalResources\google-service-account.json"
           CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

Get() accepts a path relative to that LocalResources directory. Absolute paths and paths that escape it are rejected.

Register

using Soenneker.Google.Credentials.Registrars;
using Microsoft.Extensions.DependencyInjection;

services.AddGoogleCredentialsUtilAsSingleton();

Singleton registration is recommended when scoped consumers should share the credential cache. Disposing a scoped consumer does not destroy this singleton. AddGoogleCredentialsUtilAsScoped() remains available when each scope deliberately needs an independent cache.

Get a scoped credential

ICredential credential = await credentials.Get(
    "google-service-account.json",
    ["https://www.googleapis.com/auth/indexing"],
    cancellationToken);

The file must contain a Google service-account credential. Application-default credentials and interactive user OAuth flows are not loaded by this package.

API at a glance

API What it does Result / important behavior
Get(fileName, scopes) Loads and scopes a credential, or returns its cached instance. Filename and ordered scope values form the cache key.
Remove(fileName, scopes) Asynchronously removes the matching cached credential. Returns whether an entry existed.
RemoveSync(fileName, scopes) Synchronously removes the matching cached credential. Useful only when asynchronous removal is not available to the caller.

Practical notes

  • Scope arrays are snapshotted when a credential is cached, so callers may safely reuse or modify their original arrays afterward.
  • Scope order is significant: the same scopes in a different order create a different cache entry.
  • Let the DI container dispose registered instances. Manually constructed instances must be disposed to release cached credentials.
Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Soenneker.Google.Credentials:

Package Downloads
Soenneker.Google.IndexingService

A lazy, thread-safe provider for Google Indexing API clients keyed by service-account file.

Soenneker.Google.DataManager.Client

Provides a shared authenticated Google Data Manager API client.

Soenneker.Google.SearchConsole

A utility library for Google Search Console.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.2662 0 10/30/2026
11.0.2661 258 10/29/2026
11.0.2660 279 10/27/2026
11.0.2659 269 10/27/2026
11.0.2658 146 10/26/2026
11.0.2657 115 10/26/2026
11.0.2656 106 10/26/2026
11.0.2655 114 10/26/2026
11.0.2654 121 10/26/2026
11.0.2653 142 10/26/2026
11.0.2652 102 10/26/2026
4.0.2650 502 10/15/2026
4.0.2649 121 10/14/2026
4.0.2648 132 10/14/2026
4.0.2645 172 10/14/2026
4.0.2644 156 10/14/2026
4.0.2643 94 10/14/2026
4.0.2636 186 10/13/2026
4.0.2635 99 10/13/2026
4.0.2634 140 10/12/2026
Loading failed

Update dependency Google.Apis.Auth to 1.78.0 (#3222)