# `Oidcc.ClientRegistration`
[🔗](https://github.com/erlef/oidcc/blob/ee3434ddec86c14471af8f8a8f159971e654da3c
/lib/oidcc/client_registration.ex#L4)

Dynamic Client Registration Utilities

## Telemetry

* `[:oidcc, :register_client, :start]`
  * Description: Emitted at the start of registering the client
  * Measurements: `%{system_time: non_neg_integer(), monotonic_time: integer()}`
  * Metadata: `%{issuer: :uri_string.uri_string()}`

* `[:oidcc, :register_client, :stop]`
  * Description: Emitted at the end of registering the client
  * Measurements: `%{duration: integer(), monotonic_time: integer()}`
  * Metadata: `%{issuer: :uri_string.uri_string()}`

* `[:oidcc, :register_client, :exception]`
  * Description: Emitted at the end of registering the client
  * Measurements: `%{duration: integer(), monotonic_time: integer()}`
  * Metadata: `%{issuer: :uri_string.uri_string()}`

# `t`
*since 3.0.0* 

```elixir
@type t() :: %Oidcc.ClientRegistration{
  application_type: :web | :native,
  client_name: String.t() | :undefined,
  client_uri: :uri_string.uri_string() | :undefined,
  contacts: [String.t()] | :undefined,
  default_acr_values: [String.t()] | :undefined,
  default_max_age: pos_integer() | :undefined,
  dpop_bound_access_tokens: boolean(),
  extra_fields: %{required(String.t()) =&gt; term()},
  grant_types: [String.t()] | :undefined,
  id_token_encrypted_response_alg: String.t() | :undefined,
  id_token_encrypted_response_enc: String.t() | :undefined,
  id_token_signed_response_alg: String.t() | :undefined,
  initiate_login_uri: :uri_string.uri_string() | :undefined,
  jwks: :jose_jwk.key() | :undefined,
  jwks_uri: :uri_string.uri_string() | :undefined,
  logo_uri: :uri_string.uri_string() | :undefined,
  policy_uri: :uri_string.uri_string() | :undefined,
  post_logout_redirect_uris: [:uri_string.uri_string()] | :undefined,
  redirect_uris: [:uri_string.uri_string()],
  request_object_encryption_alg: String.t() | :undefined,
  request_object_encryption_enc: String.t() | :undefined,
  request_object_signing_alg: String.t() | :undefined,
  request_uris: [:uri_string.uri_string()] | :undefined,
  require_auth_time: boolean(),
  require_pushed_authorization_requests: boolean(),
  response_types: [String.t()] | :undefined,
  sector_identifier_uri: :uri_string.uri_string() | :undefined,
  subject_type: :pairwise | :public | :undefined,
  token_endpoint_auth_method: String.t(),
  token_endpoint_auth_signing_alg: String.t() | :undefined,
  tos_uri: :uri_string.uri_string() | :undefined,
  userinfo_encrypted_response_alg: String.t() | :undefined,
  userinfo_encrypted_response_enc: String.t() | :undefined,
  userinfo_signed_response_alg: String.t() | :undefined
}
```

Client Metadata Struct

See https://openid.net/specs/openid-connect-registration-1_0.html#ClientMetadata and
https://openid.net/specs/openid-connect-rpinitiated-1_0.html#ClientMetadata

# `register`
*since 3.0.0* 

```elixir
@spec register(provider_configuration, registration, opts) ::
  {:ok, Oidcc.ClientRegistration.Response.t()}
  | {:error, :oidcc_client_registration.error()}
when provider_configuration: Oidcc.ProviderConfiguration.t(),
     registration: t(),
     opts: :oidcc_client_registration.opts()
```

Register Client

## Examples

    iex> {:ok, {provider_configuration, _expiry}} =
    ...>   Oidcc.ProviderConfiguration.load_configuration("https://accounts.google.com")
    ...>
    ...> Oidcc.ClientRegistration.register(
    ...>   provider_configuration,
    ...>   %Oidcc.ClientRegistration{
    ...>     redirect_uris: ["https://your.application.com/oidcc/callback"]
    ...>   },
    ...>   %{initial_access_token: "optional token you got from the provider"}
    ...> )
    ...> # {:ok, %Oidcc.ClientRegistration.Response{
    ...> #   client_id: client_id,
    ...> #   client_secret: client_secret
    ...> # }}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
