graphiti-api / spraypaint.js

Graphiti Client / Javascript ORM / JSONAPI
MIT License
107 stars 69 forks source link

server side usage with multiple users #107

Open house9 opened 2 years ago

house9 commented 2 years ago

Is it possible to specify a different authorization header per request?

I have a server side api (NestJS) that makes calls to another jsonapi service and I was hoping to use Spraypaint to simplify those requests.

The current implementation seems to assume this is running in a browser and uses static methods to set the authorization header.

Everything works great calling external api except the auth methods are static.

This works but seems very unsafe

Widget.setJWT(token);
const widgets = Widget.per(10).all();
Widget.setJWT("");

Is there another way to handle this scenario with Spraypaint?