object

# `open_id_client`

HTTP-facing OpenID Connect client predicates.

Availability:
`logtalk_load(open_id(loader))`
Author: Paulo Moura
Version: 1:0:0
Date: 2026-07-09
Compilation flags:
`static, context_switching_calls`
Imports:
`public` open_id_helpers
Uses:
base64
http_client
http_core
list
open_id_discovery
user
Remarks:
(none)
Inherited public predicates:
check_option/1 check_options/1 default_option/1 default_options/1 option/2 option/3 valid_option/1 valid_options/1

## Public predicates

### `discover/3`

Discovers and validates OpenID Provider metadata for the given issuer.

Compilation flags:
`static`
Template:
`discover(Issuer,Provider,Options)`
Mode and number of proofs:
`discover(+atom,-compound,+list(compound))` - `one_or_error`
Exceptions:
`Options` is a variable or a partial list:
`instantiation_error`
`Options` is neither a variable nor a list:
`type_error(list,Options)`
An element `Option` of the list `Options` is neither a variable nor a compound term:
`type_error(compound,Option)`
An element `Option` of the list `Options` is a compound term but not a valid option:
`domain_error(option,Option)`
`Issuer` is a variable:
`instantiation_error`
`Issuer` is not an absolute or allowed issuer URL:
`domain_error(open_id_issuer,Issuer)`
The discovery endpoint returned a non-success status:
`domain_error(open_id_http_status,Code)`
The discovery endpoint response body is not JSON:
`domain_error(open_id_json_response,Body)`
The discovered issuer does not match `Issuer`:
`domain_error(open_id_issuer,DiscoveredIssuer)`
A provider metadata URL is not secure:
`domain_error(open_id_provider_metadata_url,URL)`

### `jwks/3`

Fetches the JSON Web Key Set for the given provider metadata.

Compilation flags:
`static`
Template:
`jwks(Provider,JWKSet,Options)`
Mode and number of proofs:
`jwks(+compound,-term,+list(compound))` - `one_or_error`
Exceptions:
`Options` is a variable or a partial list:
`instantiation_error`
`Options` is neither a variable nor a list:
`type_error(list,Options)`
An element `Option` of the list `Options` is neither a variable nor a compound term:
`type_error(compound,Option)`
An element `Option` of the list `Options` is a compound term but not a valid option:
`domain_error(option,Option)`
The JWKS endpoint returned a non-success status:
`domain_error(open_id_http_status,Code)`
The JWKS endpoint response body is not JSON:
`domain_error(open_id_json_response,Body)`

### `exchange_code/5`

Exchanges an authorization code for token response data.

Compilation flags:
`static`
Template:
`exchange_code(Provider,Code,Session,Tokens,Options)`
Mode and number of proofs:
`exchange_code(+compound,+atom,+compound,-compound,+list(compound))` - `one_or_error`
Exceptions:
`Options` is a variable or a partial list:
`instantiation_error`
`Options` is neither a variable nor a list:
`type_error(list,Options)`
An element `Option` of the list `Options` is neither a variable nor a compound term:
`type_error(compound,Option)`
An element `Option` of the list `Options` is a compound term but not a valid option:
`domain_error(option,Option)`
`Session` is missing required authorization-code exchange data:
`domain_error(open_id_session,missing(Session,Name))`
The token endpoint returned a non-success status:
`domain_error(open_id_http_status,Code)`
The token endpoint response body is not JSON:
`domain_error(open_id_json_response,Body)`
The token endpoint JSON response is missing a required member:
`domain_error(open_id_token_response,missing(Name))`

### `refresh_token/4`

Exchanges a refresh token for token response data.

Compilation flags:
`static`
Template:
`refresh_token(Provider,RefreshToken,Tokens,Options)`
Mode and number of proofs:
`refresh_token(+compound,+atom,-compound,+list(compound))` - `one_or_error`
Exceptions:
`Options` is a variable or a partial list:
`instantiation_error`
`Options` is neither a variable nor a list:
`type_error(list,Options)`
An element `Option` of the list `Options` is neither a variable nor a compound term:
`type_error(compound,Option)`
An element `Option` of the list `Options` is a compound term but not a valid option:
`domain_error(option,Option)`
The `client_id` option is missing:
`domain_error(open_id_refresh_token,missing(client_id))`
The token endpoint returned a non-success status:
`domain_error(open_id_http_status,Code)`
The token endpoint response body is not JSON:
`domain_error(open_id_json_response,Body)`
The token endpoint JSON response is missing a required member:
`domain_error(open_id_token_response,missing(Name))`

### `userinfo/4`

Fetches UserInfo claims using the given access token.

Compilation flags:
`static`
Template:
`userinfo(Provider,AccessToken,Claims,Options)`
Mode and number of proofs:
`userinfo(+compound,+atom,-term,+list(compound))` - `one_or_error`
Exceptions:
`Options` is a variable or a partial list:
`instantiation_error`
`Options` is neither a variable nor a list:
`type_error(list,Options)`
An element `Option` of the list `Options` is neither a variable nor a compound term:
`type_error(compound,Option)`
An element `Option` of the list `Options` is a compound term but not a valid option:
`domain_error(option,Option)`
The provider metadata is missing a UserInfo endpoint:
`domain_error(open_id_provider,missing(userinfo_endpoint))`
The UserInfo endpoint returned a non-success status:
`domain_error(open_id_http_status,Code)`
The UserInfo endpoint response body is not JSON:
`domain_error(open_id_json_response,Body)`

## Protected predicates

(no local declarations; see entity ancestors if any)

## Private predicates

(no local declarations; see entity ancestors if any)

## Operators

(none)