Closed wildsurfer closed 11 months ago
You need to pass the header X-Hasura-Role
with the value of the role you want to use. You can refer to https://pub.dev/packages/graphql for more details on how to specify headers in your requests.
Closing as I don't think there is anything to do here but feel free to reopen otherwise.
Thanks!
@dbarrosop thanks for the quick response.
Here is a solution I ended up with. Leaving it here in case anyone will face the same question.
final nhostClient = NhostClient(
subdomain: Subdomain(
region: 'eu-west-2',
subdomain: 'absdef...',
),
authStore: SecureStorageProvider(),
);
final graphqlClient = createNhostGraphQLClient(nhostClient);
final QueryOptions options = QueryOptions(
document: gql(someQuery),
context: Context.fromList(const [
HttpLinkHeaders(headers: {'X-Hasura-Role': 'me'})
]),
);
I have a logged-in user. User has 2 roles:
user
andme
. By default, all requests are going out with theuser
default role. How to use theme
role for a specific request?