method

App.CreateAPIKey

Mint a revocable API bearer secret for a current session.

Arguments

ArgumentTypeDescription
ctxcontext.ContextThe ctx value.
sessionTokenstringThe sessionToken value.
namestringThe name value.
expiresAttime.TimeThe expiresAt value.

Returns

The declared result.

(APIKey, error)

How it works

Requires AuthConfig.APIKeys. The raw Key is returned once; lists expose APIKeyInfo only.

Full signature

func (application *App) CreateAPIKey( ctx context.Context, sessionToken, name string, expiresAt time.Time, ) (APIKey, error)

Source core/auth.go:556

Related types

  • App

    A resolved application bound to operation services.

  • APIKey

    A newly minted API key and its one-time secret.