Allow "extensions" in regular Graphql response
Hello,
For my application I want to have a way to prolong JWT token lifetime after each request. I'm aware about JWTRefreshTokenBundle but it requires a separate database model while my backend doesn't have a database (it's actually proxying graphql to soap using custom data providers and persisters).
I'm thinking about intercepting authorized http requests and regenerating jwt tokens on each request and sending back token back in a http header (something like this https://rojas.io/how-to-store-a-jwt-in-a-cookie-and-auto-refresh-the-token-using-lexikjwtauthenticationbundle/)
And now I think that using custom headers or cookies is not a correct way to do this. I've tried a custom SerializeStage decorator to add some data into response, but it seems that GraphQL schema also should be altered somehow otherwise this data are filtered and not returned to the client. Without modified schema I also cannot request something that my custom serializer adds to the response -- graphql parser complains about no field in the schema.
I think this is a job for "extensions" which are pretty valid response key for normal responses along with "data" not just for exceptions (https://dgraph.io/docs/graphql/api/requests/). But I can't find a way to easily extend ApiPlatform to make it return "extensions" key with arbitrary data in it for normal responses.
Could you please think about it. Thank you. API Platform is great anyway.