.. index:: single: open_id_response
.. _open_id_response/0:

.. rst-class:: right

**object**

``open_id_response``
====================

Authorization callback parsing and state validation helpers.

| **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`` :ref:`open_id_helpers <open_id_helpers/0>`
| **Uses:**
|    :ref:`http_core <http_core/0>`
|    :ref:`list <list/0>`
|    :ref:`url(Representation) <url/1>`
|    :ref:`user <user/0>`

| **Remarks:**
|    (none)

| **Inherited public predicates:**
|     :ref:`options_protocol/0::check_option/1`  :ref:`options_protocol/0::check_options/1`  :ref:`options_protocol/0::default_option/1`  :ref:`options_protocol/0::default_options/1`  :ref:`options_protocol/0::option/2`  :ref:`options_protocol/0::option/3`  :ref:`options_protocol/0::valid_option/1`  :ref:`options_protocol/0::valid_options/1`  

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

.. index:: authorization_response/3
.. _open_id_response/0::authorization_response/3:

``authorization_response/3``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Parses an authorization callback URL into either an authorization response or an authorization error term.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``authorization_response(CallbackURL,Response,Options)``
| **Mode and number of proofs:**
|    ``authorization_response(+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)``
|    ``CallbackURL`` is a variable:
|        ``instantiation_error``
|    ``CallbackURL`` is not a valid URL or relative reference:
|        ``domain_error(open_id_authorization_response,CallbackURL)``
|    The callback URL does not contain a query component and fragment parsing is not allowed:
|        ``domain_error(open_id_authorization_response,missing(parameters))``
|    The callback response is missing a required member:
|        ``domain_error(open_id_authorization_response,missing(Name))``
|    The callback issuer does not match the provider issuer:
|        ``domain_error(open_id_authorization_response,issuer_mismatch(Expected,Actual))``


------------

.. index:: authorization_code/4
.. _open_id_response/0::authorization_code/4:

``authorization_code/4``
^^^^^^^^^^^^^^^^^^^^^^^^

Parses an authorization callback URL, validates the returned state against the session, and returns the authorization code.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``authorization_code(CallbackURL,Session,Code,Options)``
| **Mode and number of proofs:**
|    ``authorization_code(+atom,+compound,-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)``
|    ``Session`` is missing required state data:
|        ``domain_error(open_id_session,missing(Session,state))``
|    The callback response is an authorization error:
|        ``domain_error(open_id_authorization_response,authorization_error(Response))``
|    The callback response state does not match the session state:
|        ``domain_error(open_id_authorization_response,state_mismatch(Expected,Actual))``
|    The callback response is missing a required member:
|        ``domain_error(open_id_authorization_response,missing(Name))``


------------

Protected predicates
--------------------

(no local declarations; see entity ancestors if any)

Private predicates
------------------

(no local declarations; see entity ancestors if any)

Operators
---------

(none)

