Table of Contents

Class AuthConfig

Namespace
Google.GenAI.Types
Assembly
Google.GenAI.dll

The authentication config to access the API.

public record AuthConfig : IEquatable<AuthConfig>
Inheritance
AuthConfig
Implements
Inherited Members

Properties

ApiKey

The authentication config to access the API. Only API key is supported. This field is not supported in Gemini API.

[JsonPropertyName("apiKey")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? ApiKey { get; set; }

Property Value

string

ApiKeyConfig

Config for API key auth.

[JsonPropertyName("apiKeyConfig")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ApiKeyConfig? ApiKeyConfig { get; set; }

Property Value

ApiKeyConfig

AuthType

Type of auth scheme.

[JsonPropertyName("authType")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public AuthType? AuthType { get; set; }

Property Value

AuthType?

GoogleServiceAccountConfig

Config for Google Service Account auth.

[JsonPropertyName("googleServiceAccountConfig")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public AuthConfigGoogleServiceAccountConfig? GoogleServiceAccountConfig { get; set; }

Property Value

AuthConfigGoogleServiceAccountConfig

HttpBasicAuthConfig

Config for HTTP Basic auth.

[JsonPropertyName("httpBasicAuthConfig")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public AuthConfigHttpBasicAuthConfig? HttpBasicAuthConfig { get; set; }

Property Value

AuthConfigHttpBasicAuthConfig

OauthConfig

Config for user oauth.

[JsonPropertyName("oauthConfig")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public AuthConfigOauthConfig? OauthConfig { get; set; }

Property Value

AuthConfigOauthConfig

OidcConfig

Config for user OIDC auth.

[JsonPropertyName("oidcConfig")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public AuthConfigOidcConfig? OidcConfig { get; set; }

Property Value

AuthConfigOidcConfig

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a AuthConfig object.

public static AuthConfig? FromJson(string jsonString, JsonSerializerOptions? options = null)

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

AuthConfig

The deserialized AuthConfig object, or null if deserialization fails.