Repository: PrefectHQ/prefect

Issue:
HTTPError attempting to retrieve a runner token from the CLI
## Description
Attempting to follow the docs, I tried to create a runner token from the command line after successfully logging in with a user token. I was greeted with an HTTPError (400)

```
(default) prefect auth login -t $(cat token)
Login successful!
(default) prefect auth create-token -n my-runner-token -r RUNNER
Traceback (most recent call last):
  File "/opt/continuum/anaconda/envs/default/bin/prefect", line 6, in <module>
    exit(cli())
  File "/opt/continuum/anaconda/envs/default/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/opt/continuum/anaconda/envs/default/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/opt/continuum/anaconda/envs/default/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/continuum/anaconda/envs/default/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/continuum/anaconda/envs/default/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/continuum/anaconda/envs/default/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/opt/continuum/anaconda/envs/default/lib/python3.8/site-packages/prefect/cli/auth.py", line 201, in create_token
    output = client.graphql(
  File "/opt/continuum/anaconda/envs/default/lib/python3.8/site-packages/prefect/client/client.py", line 212, in graphql
    result = self.post(
  File "/opt/continuum/anaconda/envs/default/lib/python3.8/site-packages/prefect/client/client.py", line 171, in post
    response = self._request(
  File "/opt/continuum/anaconda/envs/default/lib/python3.8/site-packages/prefect/client/client.py", line 314, in _request
    response.raise_for_status()
  File "/opt/continuum/anaconda/envs/default/lib/python3.8/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.prefect.io/graphql/alpha
```

## Expected Behavior
I expected to get a token



## Reproduction

```
conda create -n default -c defaults -c conda-forge prefect
source activate prefect
prefect auth login -t <TOKEN>
prefect auth create-token -n my-runner-token -r RUNNER
```

## Environment

Conda environment:
```
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
_libgcc_mutex=0.1=main
appdirs=1.4.3=pyh91ea838_0
asn1crypto=1.3.0=py38_0
blas=1.0=mkl
bokeh=2.0.1=py38_0
ca-certificates=2020.1.1=0
certifi=2020.4.5.1=py38_0
cffi=1.14.0=py38h2e261b9_0
chardet=3.0.4=py38_1003
click=7.1.1=py_0
cloudpickle=1.2.2=py_0
croniter=0.3.30=py_0
cryptography=2.8=py38h1ba5d50_0
cytoolz=0.10.1=py38h7b6447c_0
dask=2.14.0=py_0
dask-core=2.14.0=py_0
distributed=2.14.0=py38_0
docker-py=4.2.0=py38_0
docker-pycreds=0.4.0=py_0
freetype=2.9.1=h8a8886c_1
fsspec=0.7.1=py_0
heapdict=1.0.1=py_0
idna=2.9=py_1
intel-openmp=2020.0=166
jinja2=2.11.1=py_0
jpeg=9b=h024ee3a_2
ld_impl_linux-64=2.33.1=h53a641e_7
libedit=3.1.20181209=hc058e9b_0
libffi=3.2.1=hd88cf55_4
libgcc-ng=9.1.0=hdf63c60_0
libgfortran-ng=7.3.0=hdf63c60_0
libpng=1.6.37=hbc83047_0
libstdcxx-ng=9.1.0=hdf63c60_0
libtiff=4.1.0=h2733197_0
locket=0.2.0=py38_1
markupsafe=1.1.1=py38h7b6447c_0
marshmallow=3.5.1=py_0
marshmallow-oneofschema=2.0.1=py_0
mkl=2020.0=166
mkl-service=2.3.0=py38he904b0f_0
mkl_fft=1.0.15=py38ha843d7b_0
mkl_random=1.1.0=py38h962f231_0
msgpack-python=1.0.0=py38hfd86e86_1
mypy_extensions=0.4.3=py38_0
ncurses=6.2=he6710b0_0
numpy=1.18.1=py38h4f9e942_0
numpy-base=1.18.1=py38hde5b4d6_1
olefile=0.46=py_0
openssl=1.1.1f=h7b6447c_0
packaging=20.3=py_0
pandas=1.0.3=py38h0573a6f_0
partd=1.1.0=py_0
pendulum=2.1.0=py38_1
pillow=7.0.0=py38hb39fc2d_0
pip=20.0.2=py38_1
prefect=0.10.2=py_0
psutil=5.7.0=py38h7b6447c_0
pycparser=2.20=py_0
pyopenssl=19.1.0=py38_0
pyparsing=2.4.6=py_0
pysocks=1.7.1=py38_0
python=3.8.2=hcf32534_0
python-box=4.2.2=py_0
python-dateutil=2.8.1=py_0
python-slugify=3.0.4=py_0
pytz=2019.3=py_0
pytzdata=2019.3=py_0
pyyaml=5.3.1=py38h7b6447c_0
readline=8.0=h7b6447c_0
requests=2.23.0=py38_0
ruamel.yaml=0.16.5=py38h7b6447c_1
ruamel.yaml.clib=0.2.0=py38h7b6447c_0
setuptools=46.1.3=py38_0
six=1.14.0=py38_0
sortedcontainers=2.1.0=py38_0
sqlite=3.31.1=h7b6447c_0
tabulate=0.8.3=py38_0
tblib=1.6.0=py_0
text-unidecode=1.3=py_0
tk=8.6.8=hbc83047_0
toml=0.10.0=pyh91ea838_0
toolz=0.10.0=py_0
tornado=6.0.4=py38h7b6447c_1
typing_extensions=3.7.4.1=py38_0
unidecode=1.1.1=py_0
urllib3=1.25.8=py38_0
websocket-client=0.56.0=py38_0
wheel=0.34.2=py38_0
xz=5.2.4=h14c3975_4
yaml=0.1.7=had09818_2
zict=2.0.0=py_0
zlib=1.2.11=h7b6447c_3
zstd=1.3.7=h0b5b093_0
```

Prefect diagnostics:
```
{
  "config_overrides": {},
  "env_vars": [],
  "system_information": {
    "platform": "Linux-3.10.0-957.21.3.el7.x86_64-x86_64-with-glibc2.10",
    "prefect_version": "0.10.2",
    "python_version": "3.8.2"
  }
}
```



Discussion:
I should point out that a runner token retrieved from the UI works fine.
Thank for opening @mcg1969! I am able to reproduce, looks to be a change in the input to the mutation that this command needs to be adjusted for. Will make the change

Resolving patch:
diff --git a/src/prefect/cli/auth.py b/src/prefect/cli/auth.py
--- a/src/prefect/cli/auth.py
+++ b/src/prefect/cli/auth.py
@@ -182,17 +182,17 @@ def switch_tenants(id, slug):
 
 @auth.command(hidden=True)
 @click.option("--name", "-n", required=True, help="A token name.", hidden=True)
-@click.option("--role", "-r", required=True, help="A token role.", hidden=True)
-def create_token(name, role):
+@click.option("--scope", "-s", required=True, help="A token scopre.", hidden=True)
+def create_token(name, scope):
     """
     Create a Prefect Cloud API token.
 
-    For more info on API tokens visit https://docs.prefect.io/cloud/concepts/api.html
+    For more info on API tokens visit https://docs.prefect.io/orchestration/concepts/api.html
 
     \b
     Options:
         --name, -n      TEXT    A name to give the generated token
-        --role, -r      TEXT    A role for the token
+        --scope, -r     TEXT    A scope for the token
     """
     check_override_auth_token()
 
@@ -204,7 +204,7 @@ def create_token(name, role):
                 "create_api_token(input: $input)": {"token"}
             }
         },
-        variables=dict(input=dict(name=name, role=role)),
+        variables=dict(input=dict(name=name, scope=scope)),
     )
 
     if not output.get("data", None):


Test patch:
diff --git a/tests/cli/test_auth.py b/tests/cli/test_auth.py
--- a/tests/cli/test_auth.py
+++ b/tests/cli/test_auth.py
@@ -147,7 +147,7 @@ def test_create_token(patch_post):
 
     with set_temporary_config({"cloud.graphql": "http://my-cloud.foo"}):
         runner = CliRunner()
-        result = runner.invoke(auth, ["create-token", "-n", "name", "-r", "role"])
+        result = runner.invoke(auth, ["create-token", "-n", "name", "-s", "scope"])
         assert result.exit_code == 0
         assert "token" in result.output
 
@@ -157,7 +157,7 @@ def test_create_token_fails(patch_post):
 
     with set_temporary_config({"cloud.graphql": "http://my-cloud.foo"}):
         runner = CliRunner()
-        result = runner.invoke(auth, ["create-token", "-n", "name", "-r", "role"])
+        result = runner.invoke(auth, ["create-token", "-n", "name", "-s", "scope"])
         assert result.exit_code == 0
         assert "Issue creating API token" in result.output