This is hasura console environment variable screenshot,
Is it possible to assign multiple user role in hasura console?
right now its not working for me,
only public_user is working, its avoiding everything after space.
when I do query with admin_user role, I am getting error like tablename not found in query_root.
Also If I move admin_user before public_user, then public_user will stop working.
Or is there any other way we can have 2 unauthorized role in hasura.
From the docs:
You can use the env variable
HASURA_GRAPHQL_UNAUTHORIZED_ROLEor the--unauthorized-roleflag to set a role for unauthenticated (non-logged in) users.
Only one role allowed.
If you want to make requests as admin user you need to pass the value of HASURA_GRAPHQL_ADMIN_SECRET as a header.
await fetch(`https://url.com/v1/graphql`, {
method: "POST",
body: JSON.strigify({}),
headers: { "x-hasura-admin-secret": process.env.HASURA_GRAPHQL_ADMIN_SECRET },
});
This is the simplest mode of authentication. Here's how authentication with an admin secret works:
- Hasura is configured with an admin password on startup
- When making an API request the client passes the admin password in the header X-Hasura-Admin-Secret
- Hasura validates the admin secret and allows access to all resources