Skip to the content
Documentation

exp:expgraphqlkeys

No ratings yet

Available since Exponential 6.0.15 (in development, not in a release yet).

Summary

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

Usage

./console exp:expgraphqlkeys [options]
php bin/php/expgraphqlkeys.php [options]
./console exp:graphql:keys [options]

Aliases

exp:graphql:keys

Help

The output of ./console help exp:expgraphqlkeys (the script run with --help), without the standard options:

Usage: bin/php/expgraphqlkeys.php [OPTION]...
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:
  --list          list the keys (the default)
  --create        make a key (with --for)
  --for=VALUE     the owner of the new key (a login)
  --name=VALUE    the name of the new key (default: GraphQL)
  --scope=VALUE   the scopes of the new key, comma separated: graphql:read (the default), graphql:write
  --days=VALUE    the lifetime of the new key in days (rest.ini [ApiKeySettings] ExpiryChoices[]; default 90)
  --revoke=VALUE  revoke the key of this prefix (expk_...) or id
  --format=VALUE  text (the default) or json (with --list)
  --apply         write; without it nothing is changed

Options

Option Value Description
--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

Standard options

Every script also takes the standard options of the script framework: --help, --quiet, --siteaccess, --debug, --colors, --no-colors, --logfiles, --no-logfiles, --verbose and --allow-root-user.

Source

bin/php/expgraphqlkeys.php, kernel/private/classes/commands/expgraphqlkeys.php

See also

Generated example: exp:expgraphqlkeys

Added to the reference for Exponential 6.0.15.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.