graphile / crystal

🔮 Graphile's Crystal Monorepo; home to Grafast, PostGraphile, pg-introspection, pg-sql2 and much more!
https://graphile.org/
Other
12.59k stars 569 forks source link

Verifying incoming jwt in different server. #1468

Closed BiswajitBiswa closed 3 years ago

BiswajitBiswa commented 3 years ago

I have a set of REST APIs build with fastapi. And tbe client gets the jwt access token from this server. The client has also the need to make some request to graphql server(spun by postgraphile) . Is there any way or idea how can i verify the jwt tokens from client while making request to graphql server..

benjie commented 3 years ago

If the built in JWT parsing is not sufficient for your use case, use PostGraphile in library mode and use the pgSettings function to process the incoming request (including JWT) and turn it into the claims your database needs. You should probably use the jsonwebtoken module for this, or for example an Express JWT middleware.

benjie commented 3 years ago

[semi-automated message] Thanks for your question; hopefully we're well on the way to helping you solve your issue. This doesn't currently seem to be a bug in the library so I'm going to close the issue, but please feel free to keep requesting help below and if it does turn out to be a bug we can definitely re-open it 👍

You can also ask for help in the #help-and-support channel in our Discord chat.