exp:expgraphqlkeys
The personal API keys of the GraphQL API: list them, make one for a user (the token is shown once) or revoke one; a dry run unless --apply.
Script bin/php/expgraphqlkeys.php, code in kernel/private/classes/commands/expgraphqlkeys.php. Run it from the installation root, as the user the web server runs as:
./console exp:expgraphqlkeys --help
./console exp:graphql:keys --help
php bin/php/expgraphqlkeys.php --helpHelp text
The personal API keys of the GraphQL API
Lists the keys with a scope of the GraphQL API (graphql:read, graphql:write), makes one for a user
(the scopes are checked against the user's policies as on the user's own page; the token is shown
once and never stored), or revokes one. The keys are the kernel's personal API keys (rest.ini
[ApiKeySettings]): the owner manages them on the page API access, an administrator at
oauthadmin/keys. Making and revoking are recorded in the audit (access.apikey.create, .revoke).
Nothing is written without --apply.
./console exp:graphql:keys the list
./console exp:graphql:keys --list --format=json
./console exp:graphql:keys --create --for=frontend --name='Shop front end' --apply
./console exp:graphql:keys --create --for=editor --scope=graphql:read,graphql:write --days=30 --apply
./console exp:graphql:keys --revoke=expk_4f2a9c1d7e3b --apply
Exit code: 0 done (or shown); 1 the key could not be made or revoked; 2 wrong options (an unknown
user or key, a scope the user may not have, a lifetime that is not offered).Options
| Option | Value | Help |
|---|---|---|
--list | list the keys (the default) | |
--create | make a key (with --for) | |
--for | required | the owner of the new key (a login) |
--name | required | the name of the new key (default: GraphQL) |
--scope | required | the scopes of the new key, comma separated: graphql:read (the default), graphql:write |
--days | required | the lifetime of the new key in days (rest.ini [ApiKeySettings] ExpiryChoices[]; default 90) |
--revoke | required | revoke the key of this prefix (expk_...) or id |
--format | required | text (the default) or json (with --list) |
--apply | write; 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 ...).
Related
Generated by ./console exp:help:examples from bin/php/expgraphqlkeys.php, kernel/private/classes/commands/expgraphqlkeys.php. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.