Gatsby + Hasura + FusionAuth + KintoHub (My Dream Stack)
Been looking for a lot of related solutions to create my very own authentication/authorization server and then I found you, guys. You are godsent. I don't want to subscribe to something like Auth0 but if need be, I will. But as for now, I'd like to create my own so that I can create an auth microservice for my future apps.
So my current stack includes Gatsby (a static site generator) and Hasura (a very powerful GraphQL API server). I need to create something that takes care of authentication and authorization and that is where I'd like FusionAuth to take the helm. I am a big fan of yours as well as KintoHub (where I'll be deploying my FusionAuth server). I hope you can help me build a Dockerfile for it as I read that nginx is required.
Are there any Hasura + FusionAuth + Gatsby article or anything remotely related to it? I hope you can point me on the right direction, guys. Have a great day!!!
dan last edited by
We have a gatsby article here: https://fusionauth.io/blog/2020/06/25/using-oauth-and-pkce-to-add-authentication-to-your-gatsby-site
Here's an open source project using hasura and fusionauth (I just found it via a search, haven't vetted it, use at your own risk): https://github.com/mdwagner/next-great-idea
Nginx isn't required for development, but is helpful for production, as it gives you more flexibility and is a good choice for terminating SSL. You can also use a FusionAuth cloud instance and trade money for time. You can see an nginx config here: https://github.com/FusionAuth/fusionauth-contrib but I'm afraid we don't have a docker compose file for that. If you share what you've put together, happy to take a look.
Another option might be using Kintohub. I'm not familiar with Kintohub, but it looks cool. Looks like you could run a docker image of FusionAuth using the Dockerfile build setting: https://docs.kintohub.com/anatomy/build-settings/#general-build-settings
Have you tried that?
You also might be interested in this forum post: https://fusionauth.io/community/forum/topic/337/can-you-use-fusionauth-with-graphql as a community member has put together a schema.
And this looks useful: https://hasura.io/docs/1.0/graphql/core/auth/authentication/jwt.html
Seems like you need to set some custom JWT claims, which you can do with a lambda.
Before anything else, thanks for the reply. I deeply appreciate it.
I'm just sad that I can't comprehend everything you just typed for several reasons:
0 - I am still a student learning bunch of stuff all at the same time so everything is kinda confusing and reverse engineering other people's works is kinda impossible as of the moment. I'm really sorry if I can't comprehend your instructions yet. What I'm currently learning are not even within my school's curriculum but I really really wanted to create my own auth server using yours. I feel like it'll be a useful experience for my future projects. Not relying on Auth0, Firebase, AWS Cognito, Netlify Identity, and many more might really be possible if I can understand how FusionAuth works.
1 - I'm not really good with Docker. I just ask help from KintoHub devs (on their Discord Server) when building a Dockerfile to be deployed on their server. They are really accommodating and I am also rooting for their success just like how I am rooting for you, guys. Both of your technologies are new to the market but I can see that you have limitless potentials. Just thinking about both of your techs to succeed in the future makes me really excited. Maybe you can partner up with them so that you can have "One Click Deploy to KintoHub" just like like Hasura's "One Click Deploy to Heroku"? Dunno, might be both good advertisement for both of your techs.
2 - The only experience that I had that is related to authentication service is using Laravel's built in authentication/authorization. They have this /login RESTful endpoint where we can send a POST request with user login info in its body then the Laravel API tries to authenticate and if authenticated, it will either send a cookie or a JWT which we can pass back and forth for every resource request. Then it has this /register and /logout endpoints as well.
3 - After reading the Gatsby-FusionAuth tutorial, I read that it requires another NodeJS backend which made me step back a little. In the first place, the reason why I want to create my own auth server is for it to be the sole authentication microservice between Gatsby and Hasura. Putting another NodeJS between them adds more pain than solution for me because now I need to learn how to create a NodeJS server.
I'm really sorry if I just wasted your precious time. Thanks for replying. I hope there'll be someone who can create a tailored solution for my dream stack: Hasura + FusionAuth + Gatsby. I guess for now, it'll be just Hasura + Auth0 + Gatsby. All I can do is hope for now...
dan last edited by
No worries. If you want to get a feel for FusionAuth, highly recommend the 5 minute setup guide.
Thanks for the recommendation about kintohub, I'll put it on the list .
We recommend using the node backend for gatsby because there really isn't a safe way to store authentication tokens in the browser. Secure HttpOnly cookies are the best option, but that still requires a server, as outlined here: https://fusionauth.io/learn/expert-advice/authentication/webapp/oauth-authorization-code-grant-jwts-refresh-tokens-cookies
Either way, hope your side project goes well!
Just wanted to bop in here and say that i am working on a FusionAuth + Hasura tutorial
@fusionauth_user Seriously?! That would be awesome!
@fusionauth_user Hi, Sir. Just visiting once again this thread. Is it really possible to use it with Hasura?
yeah, pretty simple really, if you want to try it yourself before my tutorial is out, try using the hasura cloud + Auth0 tutorial on Hasura's site, and use the lessons from that to use it with fusionauth.