# Interface: OAuth2DynamicCodeAuthentication

Defined in: [types.ts:625](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L625)

OAuth2 authentication with Dynamic Client Registration (DCR) enabled. `authorizationUrl` and `tokenUrl` are optional because they are automatically discovered using the pack's declared MCP servers and network domains.

## Extends

- `BaseOAuth2CodeAuthentication`

## Properties

### additionalParams?

> `optional` **additionalParams**: `object`

Defined in: [types.ts:554](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L554)

Option custom URL parameters and values that should be included when redirecting the user to the [authorizationUrl](#authorizationurl).

#### Index Signature

#### Inherited from

`BaseOAuth2CodeAuthentication.additionalParams`

______________________________________________________________________

### authorizationUrl?

> `optional` **authorizationUrl**: `string`

Defined in: [types.ts:630](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L630)

The URL to which the user will be redirected in order to authorize this pack. Optional when using DCR, as it is automatically discovered.

______________________________________________________________________

### credentialsLocation?

> `optional` **credentialsLocation**: [`TokenExchangeCredentialsLocation`](../../enumerations/TokenExchangeCredentialsLocation/)

Defined in: [types.ts:525](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L525)

When making the token exchange request, where to pass the client credentials (client ID and client secret). The default is [TokenExchangeCredentialsLocation#Automatic](../../enumerations/TokenExchangeCredentialsLocation/#automatic), which should work for most providers. Pick a more specific option if the provider invalidates authorization codes when there is an error in the token exchange.

#### Inherited from

`BaseOAuth2CodeAuthentication.credentialsLocation`

______________________________________________________________________

### endpointDomain?

> `optional` **endpointDomain**: `string`

Defined in: [types.ts:283](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L283)

When requiresEndpointUrl is set to true, this should be the root domain that all endpoints share. For example, this value would be "example.com" if specific endpoints looked like {custom-subdomain}.example.com.

For packs that make requests to multiple domains (uncommon), this should be the domain within [PackVersionDefinition.networkDomains](../PackVersionDefinition/#networkdomains) that this configuration applies to.

#### Inherited from

`BaseOAuth2CodeAuthentication.endpointDomain`

______________________________________________________________________

### endpointKey?

> `optional` **endpointKey**: `string`

Defined in: [types.ts:564](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L564)

In rare cases, OAuth providers will return the specific API endpoint domain for the user as part of the OAuth token exchange response. If so, this is the property in the OAuth token exchange response JSON body that points to the endpoint.

The endpoint will be saved along with the account and will be available during execution as [ExecutionContext.endpoint](../ExecutionContext/#endpoint).

#### Inherited from

`BaseOAuth2CodeAuthentication.endpointKey`

______________________________________________________________________

### getConnectionName?

> `optional` **getConnectionName**: [`MetadataFormula`](../../type-aliases/MetadataFormula/)

Defined in: [types.ts:251](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L251)

A function that is called when a user sets up a new account, that returns a name for the account to label that account in the UI. The user's credentials are applied to any fetcher requests that this function makes. Typically, this function makes an API call to an API's "who am I" endpoint and returns a username.

If omitted, or if the function returns an empty value, the account will be labeled with the creating user's Coda username.

#### Inherited from

`BaseOAuth2CodeAuthentication.getConnectionName`

______________________________________________________________________

### instructionsUrl?

> `optional` **instructionsUrl**: `string`

Defined in: [types.ts:266](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L266)

A link to a help article or other page with more instructions about how to set up an account for this pack.

#### Inherited from

`BaseOAuth2CodeAuthentication.instructionsUrl`

______________________________________________________________________

### nestedResponseKey?

> `optional` **nestedResponseKey**: `string`

Defined in: [types.ts:518](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L518)

In rare cases, OAuth providers send back access tokens nested inside another object in their authentication response.

#### Inherited from

`BaseOAuth2CodeAuthentication.nestedResponseKey`

______________________________________________________________________

### networkDomain?

> `optional` **networkDomain**: `string` | `string`[]

Defined in: [types.ts:297](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L297)

Which domain(s) should get auth credentials, when a pack is configured with multiple domains. Packs configured with only one domain or with requiresEndpointUrl set to true can omit this.

Using multiple authenticated network domains is uncommon and requires Coda approval.

#### Inherited from

`BaseOAuth2CodeAuthentication.networkDomain`

______________________________________________________________________

### pkceChallengeMethod?

> `optional` **pkceChallengeMethod**: `"plain"` | `"S256"`

Defined in: [types.ts:581](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L581)

See [useProofKeyForCodeExchange](#useproofkeyforcodeexchange)

#### Inherited from

`BaseOAuth2CodeAuthentication.pkceChallengeMethod`

______________________________________________________________________

### postSetup?

> `optional` **postSetup**: [`SetEndpoint`](../SetEndpoint/)[]

Defined in: [types.ts:289](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L289)

One or more setup steps to run after the user has set up the account, before completing installation of the pack. This is not common.

#### Inherited from

`BaseOAuth2CodeAuthentication.postSetup`

______________________________________________________________________

### requiresEndpointUrl?

> `optional` **requiresEndpointUrl**: `boolean`

Defined in: [types.ts:274](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L274)

If true, indicates this pack has a specific endpoint domain for each account, that is used as the basis of HTTP requests. For example, API requests are made to .example.com rather than example.com. If true, the user will be prompted to provide their specific endpoint domain when creating a new account.

#### Inherited from

`BaseOAuth2CodeAuthentication.requiresEndpointUrl`

______________________________________________________________________

### scopeDelimiter?

> `optional` **scopeDelimiter**: `" "` | `","` | `";"`

Defined in: [types.ts:509](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L509)

The delimiter to use when joining [scopes](#scopes) when generating authorization URLs.

The OAuth2 standard is to use spaces to delimit scopes, and Coda will do that by default. If the API you are using requires a different delimiter, say a comma, specify it here.

#### Inherited from

`BaseOAuth2CodeAuthentication.scopeDelimiter`

______________________________________________________________________

### scopeParamName?

> `optional` **scopeParamName**: `string`

Defined in: [types.ts:502](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L502)

In rare cases, OAuth providers may want the permission scopes in a different query parameter than `scope`.

#### Inherited from

`BaseOAuth2CodeAuthentication.scopeParamName`

______________________________________________________________________

### scopes?

> `optional` **scopes**: `string`[]

Defined in: [types.ts:497](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L497)

Scopes that are required to use this pack.

Each API defines its own list of scopes, or none at all. You should consult the documentation for the API you are connecting to.

#### Inherited from

`BaseOAuth2CodeAuthentication.scopes`

______________________________________________________________________

### tokenPrefix?

> `optional` **tokenPrefix**: `string`

Defined in: [types.ts:533](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L533)

A custom prefix to be used when passing the access token in the HTTP Authorization header when making requests. Typically this prefix is `Bearer` which is what will be used if this value is omitted. However, some services require a different prefix. When sending authenticated requests, an HTTP header of the form `Authorization: <tokenPrefix> <token>` will be used.

#### Inherited from

`BaseOAuth2CodeAuthentication.tokenPrefix`

______________________________________________________________________

### tokenQueryParam?

> `optional` **tokenQueryParam**: `string`

Defined in: [types.ts:539](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L539)

In rare cases, OAuth providers ask that a token is passed as a URL parameter rather than an HTTP header. If so, this is the name of the URL query parameter that should contain the token.

#### Inherited from

`BaseOAuth2CodeAuthentication.tokenQueryParam`

______________________________________________________________________

### tokenUrl?

> `optional` **tokenUrl**: `string`

Defined in: [types.ts:632](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L632)

The URL for token exchange. Optional when using DCR, as it is automatically discovered.

#### Overrides

`BaseOAuth2CodeAuthentication.tokenUrl`

______________________________________________________________________

### type

> **type**: [`OAuth2`](../../enumerations/AuthenticationType/#oauth2)

Defined in: [types.ts:548](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L548)

Identifies this as OAuth2 authentication.

#### Inherited from

`BaseOAuth2CodeAuthentication.type`

______________________________________________________________________

### useDynamicClientRegistration

> **useDynamicClientRegistration**: `true`

Defined in: [types.ts:641](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L641)

Indicates that this OAuth provider supports Dynamic Client Registration. When enabled, the Coda platform will automatically discover authorization endpoints and dynamically register OAuth client credentials (client ID and secret) using the pack's declared MCP servers and network domains.

See https://datatracker.ietf.org/doc/html/rfc7591 for more details.

______________________________________________________________________

### useProofKeyForCodeExchange?

> `optional` **useProofKeyForCodeExchange**: `boolean`

Defined in: [types.ts:576](https://github.com/coda/packs-sdk/blob/9f37f0e6dd85972eb9c035c2bb489cbeb06120bc/types.ts#L576)

Option to apply PKCE (Proof Key for Code Exchange) OAuth2 extension. With PKCE extension, a `code_challenge` parameter and a `code_challenge_method` parameter will be sent to the authorization page. A `code_verifier` parameter will be sent to the token exchange API as well.

`code_challenge_method` defaults to SHA256 and can be configured with [pkceChallengeMethod](#pkcechallengemethod).

See https://datatracker.ietf.org/doc/html/rfc7636 for more details.

#### Inherited from

`BaseOAuth2CodeAuthentication.useProofKeyForCodeExchange`
