Forwarding auth context to/from remote schemas

Introduction

This page gives an overview of how Hasura allows you to pass auth context to your remote schema server.

Passing headers from Hasura to your remote schema

Hasura will forward the resolved x-hasura-* values as headers to your remote schema. You can use this information to apply authorization rules in your server. You don’t have to redo authentication in your remote schema server.

You can also configure Hasura to have (as shown here):

  1. static header values that are sent to the remote server
  2. forward all headers from the client (like Authorization, Cookie headers etc.)
  3. Fine grained access control

In case there are multiple headers with same name, the order of precedence is: configuration headers > resolved user (x-hasura-*) variables > client headers.

So for example, if the client sends an Authorization header, and the configuration also has an Authorization header, the configuration header value will selected.

Note

The headers from the client behave similarly to the authorization system. If x-hasura-admin-secret is sent, then all x-hasura-* values from the client are respected, otherwise they are ignored.