Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,220 of 9,220 pages
About the help in other languages
All help pages

exp:expgraphqlpublickey

Make the public read key of a front end in one command: a role, a user group and a user that only read, then the key (shown once); list or revoke the public keys; a dry run unless --apply.

Download as PDF

Address: https://doc.exponential.earth/learninminutes/exphelp/viewer/examples/commands/expgraphqlpublickey.md

On this page

exp:expgraphqlpublickey

Make the public read key of a front end in one command: a role, a user group and a user that only read, then the key (shown once); list or revoke the public keys; a dry run unless --apply.

Script bin/php/expgraphqlpublickey.php, code in kernel/private/classes/commands/expgraphqlpublickey.php. Run it from the installation root, as the user the web server runs as:

./console exp:expgraphqlpublickey --help
./console exp:graphql:public-key --help
php bin/php/expgraphqlpublickey.php --help

Help text

The public read key of a front end
A public read key (only graphql:read, only the siteaccesses of --siteaccess) needs an owner that
only reads. This command makes that owner once: the role "GraphQL public reader" (content/read as
the anonymous user of the siteaccesses reads, and apikey/create with the Scope graphql:read; no
user/login, so the owner cannot sign in), the hidden user group "GraphQL public readers" below the
user root node with the role, and the user graphql-public in it (a random password nobody is shown).
Then it makes the key and shows the token once. Run again, it reuses the role, the group and the
user, and makes no second key for the same siteaccesses unless --new. Making and revoking keys are
recorded in the audit (access.apikey.create, .revoke), the role in access.role.create.
Nothing is written without --apply.

./console exp:graphql:public-key --siteaccess=site                  what would be made
./console exp:graphql:public-key --siteaccess=site,site_de --name='Shop front end' --apply
./console exp:graphql:public-key --siteaccess=site --new --days=30 --apply
./console exp:graphql:public-key --list
./console exp:graphql:public-key --revoke=expk_4f2a9c1d7e3b --apply

Exit code: 0 done (or shown, or the key exists already); 1 the owner or the key could not be made,
or the key not revoked; 2 wrong options (no or an unknown siteaccess, an anonymous user that reads
nothing, a lifetime that is not offered, an unknown key, a user graphql-public of someone else).

Options

OptionValueHelp
--siteaccessrequiredthe siteaccesses the key works in, comma separated (required to make a key)
--namerequiredthe name of the key (default: GraphQL public key)
--daysrequiredthe lifetime of the key in days (rest.ini [ApiKeySettings] ExpiryChoices[]; default DefaultExpiryDays, as on the key page)
--newmake another key although an active public key for these siteaccesses exists
--listlist the public read keys: prefix, status, siteaccesses, expiry, owner
--revokerequiredrevoke the public read key of this prefix (expk_...)
--applywrite; without it nothing is changed

Read from the option definitions in the code (startup(), getOptions(), options() or ezcConsoleOption). Every script also takes the standard options of the script framework (--help, --siteaccess, --debug, --quiet, --allow-root-user ...).


Generated by ./console exp:help:examples from bin/php/expgraphqlpublickey.php, kernel/private/classes/commands/expgraphqlpublickey.php. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x