object

# `open_id_pkce`

PKCE and authorization-request helpers for OpenID Connect clients.

Availability:
`logtalk_load(open_id(loader))`
Author: Paulo Moura
Version: 1:0:0
Date: 2026-07-08
Compilation flags:
`static, context_switching_calls`
Imports:
`public` open_id_helpers
Uses:
crypto
sha256
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

### `code_verifier/2`

Returns a valid PKCE code verifier, either provided in options or freshly generated.

Compilation flags:
`static`
Template:
`code_verifier(Verifier,Options)`
Mode and number of proofs:
`code_verifier(-atom,+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)`
`Verifier` is a variable:
`instantiation_error`
`Verifier` is not a valid PKCE code verifier:
`domain_error(open_id_code_verifier,Verifier)`

### `code_challenge/2`

Computes the S256 PKCE code challenge for a code verifier.

Compilation flags:
`static`
Template:
`code_challenge(Verifier,Challenge)`
Mode and number of proofs:
`code_challenge(+atom,-atom)` - `one_or_error`
Exceptions:
`Verifier` is a variable:
`instantiation_error`
`Verifier` is not a valid PKCE code verifier:
`domain_error(open_id_code_verifier,Verifier)`

### `authorization_url/5`

Builds an authorization URL and session data for an Authorization Code plus PKCE flow.

Compilation flags:
`static`
Template:
`authorization_url(Provider,Request,URL,Session,Options)`
Mode and number of proofs:
`authorization_url(+compound,+compound,-atom,-compound,+list(compound))` - `one_or_error`
Exceptions:
`Request` is neither a direct options list nor a request wrapper term containing an options list:
`domain_error(open_id_options,Request)`
`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)`
`Request` is missing a required authorization request option:
`domain_error(open_id_authorization_request,missing(Name))`
A request value that must be an atom is not an atom:
`type_error(atom,Value)`
A scope value is neither an atom nor a list of atoms:
`domain_error(open_id_space_separated_atom,Value)`
The PKCE code verifier is a variable:
`instantiation_error`
The PKCE code verifier is not valid:
`domain_error(open_id_code_verifier,Verifier)`

## Protected predicates

(no local declarations; see entity ancestors if any)

## Private predicates

(no local declarations; see entity ancestors if any)

## Operators

(none)