Graphql-engine: Anonymous subscriptions

Created on 26 Feb 2019  Â·  4Comments  Â·  Source: hasura/graphql-engine

In my usecase I need anonymous subscriptions on the client side (from browser). And it looks like they are not available at all.
Moreover, subsriptions work only if I pass admin secret key in 'x-hasura-admin-secret', that means that I need to put admin secret key on the client side? Or I'm missing something?

Most helpful comment

You were very helpfull! Thank you very much, everything seams just working.

All 4 comments

@altteo We need to document this, but this fairly easy to do!

There is a flag --unauthorized-role and an env var HASURA_GRAPHQL_UNAUTHORIZED_ROLE available for server to set a role which can be used when the request is not authenticated. Hope this covers your use-case.

https://docs.hasura.io/1.0/graphql/manual/deployment/graphql-engine-flags/reference.html#command-flags

Related issue: https://github.com/hasura/graphql-engine/issues/595

Not obvious how to set this flags, when hasura is installed as container on the digital ocean host.

Head to the docker compose file or the docker run script and set the env
var.

Considering that you’ve done this for setting up your admin secret you’re
probably familiar with setting env vars.

So now add another env var called hasura_graphql_unauthorized_role and set
the value to anonymous

Here’s a reference to update env vars if you were doing this with the DO
one click:
https://docs.hasura.io/1.0/graphql/manual/guides/deployment/digital-ocean-one-click.html#secure-the-graphql-endpoint

On Tue, 26 Feb 2019 at 12:55 PM, Fedor Leschinsky notifications@github.com
wrote:

Not obvious how to set this flags, when hasura is installed as container
on the digital ocean host.

—
You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/hasura/graphql-engine/issues/1670#issuecomment-467609852,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAIAWEgHNtT7ekauIbWl3s2KyfEHe_vWks5vRZ9SgaJpZM4bSTk6
.

You were very helpfull! Thank you very much, everything seams just working.

Was this page helpful?
0 / 5 - 0 ratings