mirror of
https://github.com/hanzoai/openid-client.git
synced 2026-09-24 17:01:10 +00:00
63 lines
1.8 KiB
Markdown
63 lines
1.8 KiB
Markdown
# Function: ClientSecretBasic()
|
|
|
|
[💗 Help the project](https://github.com/sponsors/panva)
|
|
|
|
Support from the community to continue maintaining and improving this module is welcome. If you find the module useful, please consider supporting the project by [becoming a sponsor](https://github.com/sponsors/panva).
|
|
|
|
***
|
|
|
|
â–¸ **ClientSecretBasic**(`clientSecret?`): [`ClientAuth`](../type-aliases/ClientAuth.md)
|
|
|
|
**`client_secret_basic`** uses the HTTP `Basic` authentication scheme to send
|
|
`client_id` and `client_secret` in an `Authorization` HTTP Header.
|
|
|
|
## Parameters
|
|
|
|
| Parameter | Type | Description |
|
|
| ------ | ------ | ------ |
|
|
| `clientSecret?` | `string` | Client Secret |
|
|
|
|
## Returns
|
|
|
|
[`ClientAuth`](../type-aliases/ClientAuth.md)
|
|
|
|
## Examples
|
|
|
|
Usage with a [Configuration](../classes/Configuration.md) obtained through [discovery](discovery.md)
|
|
|
|
```ts
|
|
let server!: URL
|
|
let clientId!: string
|
|
let clientSecret!: string
|
|
let clientMetadata!: Partial<client.ClientMetadata> | string | undefined
|
|
|
|
let config = await client.discovery(
|
|
server,
|
|
clientId,
|
|
clientMetadata,
|
|
client.ClientSecretBasic(clientSecret),
|
|
)
|
|
```
|
|
|
|
Usage with a [Configuration](../classes/Configuration.md) instance
|
|
|
|
```ts
|
|
let server!: client.ServerMetadata
|
|
let clientId!: string
|
|
let clientSecret!: string
|
|
let clientMetadata!: Partial<client.ClientMetadata> | string | undefined
|
|
|
|
let config = new client.Configuration(
|
|
server,
|
|
clientId,
|
|
clientMetadata,
|
|
client.ClientSecretBasic(clientSecret),
|
|
)
|
|
```
|
|
|
|
## See
|
|
|
|
- [OAuth Token Endpoint Authentication Methods](https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#token-endpoint-auth-method)
|
|
- [RFC 6749 - The OAuth 2.0 Authorization Framework](https://www.rfc-editor.org/rfc/rfc6749.html#section-2.3)
|
|
- [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0-errata2.html#ClientAuthentication)
|