question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom X-Hasura headers ignored when authorization passed

See original GitHub issue

Consider an app that allows anonymous viewing of shared data through a ‘code’. The code is passed via an X-Hasura-Share header. An Hasura permission role viewer is created and set as default for the unauthenticated. This viewer role enables read only permission for the row whose id matches the X-Hasura-Share value. This all works great.

However, when an authenticated user (passing authorization header with correct token) tries to use that same share code, Hasura returns no data. This happens even though the X-Hasura-Role is set to viewer in the request headers (and the authenticated user is allowed that role). Note that Hasura does not error at all, it just returns an empty data set. It seems that as soon as the auth header is set the X-Hasura-Share header is ignored.

Is this behaviour expected or a bug?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tirumaraiselvancommented, Sep 1, 2020

I think it may not be documented: https://github.com/hasura/graphql-engine/issues/4101

0reactions
martinpengellyphillipscommented, Sep 1, 2020

My original question is answered (is it expected behaviour or a bug) so I will close this issue and follow the other one’s linked to. Thanks again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

docs: document when x-hasura-* headers are ignored · Issue #4101 ...
When auth is enabled only x-hasura-role is respected from client, rest all are ignored. Event Triggers / Remote Schemas / Actions configuration with ......
Read more >
Authentication using JWT | Hasura GraphQL Docs
JWT authentication is enforced when the X-Hasura-Admin-Secret header is not found in the request. JWT authentication is skipped when the X-Hasura-Admin-Secret ...
Read more >
Access control examples | Hasura GraphQL Docs
Access control examples. Introduction​. This is a guide to help you set up a basic authorization architecture for your GraphQL fields.
Read more >
Forwarding auth context to/from remote schemas - Hasura
This page gives an overview of how Hasura allows you to pass auth context to your remote schema server. Passing headers from Hasura...
Read more >
Authentication using webhooks | Hasura GraphQL Docs
The configured webhook is ignored when the X-Hasura-Admin-Secret header is found in the request and admin access is granted.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found