yucky-goldY
Refine4y ago
4 replies
yucky-gold

hasura data provider - pass token in header before request

I've configured my hasura endpoint so that an Authrization Header must be populated with a value (i.e. bearer token provide by firebase authentication). That token is available via the usePermissions hook. How would I set headers of the graph-ql client after it's been initialized?

I'm thinking I'd modify the dataProvider to accept an additional parameter, that calls the 'setHeader' method of the client.

What do you think?

edited: it looks like i'd use the 'custom' method, or yoink the header logic into the other methods.
Was this page helpful?