Credentials

Credentials Configuration (CredentialsConfig)

CredentialsConfig holds the OAuth endpoints, redirect URIs, vault API base URLs, and field-name keys used by every credential service. CredentialsConfig.Load() reads ./credentialsConfig.json (or returns defaults) and Save() writes it back - customize once for self-hosted or non-default endpoints.

CredentialsConfig holds the OAuth endpoints, redirect URIs, vault API base URLs, and field-name keys used by every credential service. CredentialsConfig.Load() reads ./credentialsConfig.json (or returns defaults) and Save() writes it back - customize once for self-hosted or non-default endpoints.

Every GPAL.Credentials object loads a CredentialsConfig automatically via its Config property. CredentialsConfig.Load() reads ./credentialsConfig.json if it exists, falling back to built-in defaults for Google, Azure, AWS, and Bitwarden endpoints, OAuth redirect URIs, and the form field names (grant_type, username, password, client_id, client_secret, access_token, etc.) used when building token requests. Call Save() after changing values to persist them to ./credentialsConfig.json for future runs.

TIP

CredentialsConfig.UseRestRedirect (default true) controls how OAuth authorization codes are obtained: when true, GPAL polls GPALRESTAPI's get-access-token endpoint after the redirect; when false, the user is prompted to paste the authorization code manually.

Examples

GPAL Fluent: High-level fluent C# API

//CredentialsConfig.Load()/Save() read and write ./credentialsConfig.json relative to the application's working directory. Changes apply to every GPAL.Credentials object created afterward in the same run, and persist across future runs once Save() is called.

// Point Bitwarden at a self-hosted / EU instance and persist it var config = CredentialsConfig.Load(); config.BitwardenAuthBase = "https://identity.bitwarden.eu"; config.BitwardenVaultBase = "https://api.bitwarden.eu"; config.Save(); // Subsequent Credentials objects pick up the saved config automatically var bwGrid = GPAL.Grid.ToGPALObject(); GPAL.CredentialsFor(CredentialServiceType.Bitwarden) .WithServiceKey("client-id:client-secret") .WithUsername("you@example.com") .WithPassword("master-password") .GetCredentialsFor("example.com") .SaveTo(bwGrid);