2018-09-11 14:11:24 +03:00
|
|
|
Securing the GraphQL endpoint (Heroku)
|
|
|
|
======================================
|
|
|
|
|
2018-12-03 15:12:24 +03:00
|
|
|
.. contents:: Table of contents
|
|
|
|
:backlinks: none
|
|
|
|
:depth: 1
|
|
|
|
:local:
|
|
|
|
|
2018-09-11 14:11:24 +03:00
|
|
|
To make sure that your GraphQL endpoint and the Hasura console are not publicly accessible, you need to
|
2019-02-14 12:37:47 +03:00
|
|
|
configure an admin secret key.
|
2018-09-11 14:11:24 +03:00
|
|
|
|
|
|
|
|
2019-02-14 12:37:47 +03:00
|
|
|
Add the HASURA_GRAPHQL_ADMIN_SECRET env var
|
|
|
|
-------------------------------------------
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-02-14 12:37:47 +03:00
|
|
|
Head to the config-vars URL on your Heroku dashboard and set the ``HASURA_GRAPHQL_ADMIN_SECRET`` environment variable.
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-03-13 13:03:45 +03:00
|
|
|
.. thumbnail:: ../../../../img/graphql/manual/deployment/secure-heroku.png
|
2018-09-11 14:11:24 +03:00
|
|
|
|
|
|
|
Setting this environment variable will automatically restart the dyno. Now when you access your console, you'll be
|
2019-02-14 12:37:47 +03:00
|
|
|
prompted for the admin secret key.
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-03-13 13:03:45 +03:00
|
|
|
.. thumbnail:: ../../../../img/graphql/manual/deployment/access-key-console.png
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-03-06 11:58:04 +03:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
The ``HASURA_GRAPHQL_ADMIN_SECRET`` should never be passed from the client to Hasura GraphQL engine as it would
|
|
|
|
give the client full admin rights to your Hasura instance. See :doc:`../../auth/index` for information on
|
|
|
|
setting up Authentication.
|
|
|
|
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-02-14 12:37:47 +03:00
|
|
|
(optional) Use the admin secret with the CLI
|
|
|
|
--------------------------------------------
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-02-14 12:37:47 +03:00
|
|
|
In case you're using the CLI to open the Hasura console, use the ``admin-secret`` flag when you open the console:
|
2018-09-11 14:11:24 +03:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2019-02-14 12:37:47 +03:00
|
|
|
hasura console --admin-secret=myadminsecretkey
|
2018-09-11 14:11:24 +03:00
|
|
|
|