Credentials

Credentials Entry Point and Account Setters

GPAL.Credentials and GPAL.CredentialsFor(serviceType) both start a credentials request; WithService selects the provider, and WithUsername/WithPassword set the account used to authenticate.

GPAL.Credentials and GPAL.CredentialsFor(serviceType) both start a credentials request; WithService selects the provider, and WithUsername/WithPassword set the account used to authenticate.

GPAL.Credentials returns the start of the fluent chain (call .WithService(serviceType) next); GPAL.CredentialsFor(serviceType) is shorthand for GPAL.Credentials.WithService(serviceType) - both produce an identical ICredentials chain. CredentialServiceType selects the provider: LastPass, OnePassword, Dashlane, Bitwarden, Keeper, Google, Azure, AWS, or None (direct username/password, no provider). WithUsername and WithPassword set the account used to authenticate with that provider - for password-manager vaults this is the vault's master login, for Google/Azure/AWS this is the account used during the OAuth consent flow, and for None this is the credential pair SaveTo writes out directly. WithUsername/WithPassword must be called before WithServiceKey, WithClientId, WithServiceAccountKey, WithScope, or GetCredentialsFor become available on the chain.

Examples

GPAL Fluent: High-level fluent C# API

//creds1 and creds2 are equivalent - GPAL.CredentialsFor(type) is simply GPAL.Credentials.WithService(type) in one step. From here, continue the chain with WithServiceKey/WithClientId/WithServiceAccountKey (see OAuth and Service Account) for Google/Azure/AWS, or with GetCredentialsFor/WithDomain/SaveTo (see Password Manager Vaults) for LastPass/OnePassword/Dashlane/Bitwarden/Keeper.

// GPAL.Credentials + WithService (long form) var creds1 = GPAL.Credentials .WithService(CredentialServiceType.Google) .WithUsername("you@example.com") .WithPassword("your-password") .ToGPALObject(); // GPAL.CredentialsFor (shorthand for the long form above) var creds2 = GPAL.CredentialsFor(CredentialServiceType.Google) .WithUsername("you@example.com") .WithPassword("your-password") .ToGPALObject();