Skip to content

OIDC — ID Tokens

OpenID Connect Core · package oidc/core/authorization_code

Implements ID Token generation as an extension for the Authorization Code flow. See OpenID Connect for the conceptual explanation of what an ID Token is and when you need one.

Construction

go
import oidcflow "github.com/alkeyio/authkit/oidc/core/authorization_code"

oidc, err := oidcflow.Must(
    oidcflow.NewConfig().
        SetIssuer("https://auth.example.com").
        SetSigningKey(privateKey, jwt.SigningMethodRS256, "key-1"),
)

Configuration

SetterPurpose
SetIssuerSets the iss claim on every issued ID Token.
SetSigningKeyPrivate key, signing method, and key ID (kid) used to sign ID Tokens.

Registering

go
cfg.RegisterExtension(oidc)

This implements TokenProcessor: after the base Authorization Code flow prepares its token response, the OIDC extension attaches a signed id_token. See Extension System.

See also

  • PKCE — typically registered alongside OIDC on the same flow.
  • JWT Access Tokens — a related but distinct JWT: this issues the ID Token, RFC 9068 issues the access token.

Released under the BSD-3-Clause License.