.. _specs/rfc9207:

RFC9207: OAuth 2.0 Authorization Server Issuer Identification
=============================================================

This section contains the generic implementation of :rfc:`RFC9207 <9207>`.

In summary, RFC9207 advise to return an ``iss`` parameter in authorization code responses.
This can simply be done by implementing the :meth:`~authlib.oauth2.rfc9207.parameter.IssuerParameter.get_issuer` method in the :class:`~authlib.oauth2.rfc9207.parameter.IssuerParameter` class,
and pass it as a :class:`~authlib.oauth2.rfc6749.grants.AuthorizationCodeGrant` extension::

    from authlib.oauth2.rfc9207.parameter import IssuerParameter as _IssuerParameter

    class IssuerParameter(_IssuerParameter):
        def get_issuer(self) -> str:
            return "https://auth.example.org"

    ...

    authorization_server.register_grant(AuthorizationCodeGrant, [IssuerParameter()])

API Reference
-------------

.. module:: authlib.oauth2.rfc9207

.. autoclass:: IssuerParameter
    :member-order: bysource
    :members:

