This project is highly inspired by Hasura NodeJS auth webhook boilerplate.
This webhook will verify the token.
Generally, Hasura has 3 modes to authenticate users:
- Webhook*
- JWT (JSON Web Token)
- Unauthenticated / Public Access
You can see more how it works here.
This Firebase Auth is intended to work with Webhook
If the user is successfully authenticated, the webhook will return the following result to the Hasura server:
$ curl -i localhost:8081 -H "Authorization: Bearer <Firebase token>"
HTTP 200 OK
Content-Type: application/json
Cache-Control: 300
{
"X-Hasura-User-Id": <Firebase UID>,
"X-Hasura-Role": "user",
}
-
Download and launch the webhook server
$ export GOOGLE_APPLICATION_CREDENTIALS="<path to service-account.json file>" $ curl -o <file to download> | sh
-
Start the Hasura GraphQL engine and point the authentication webhook to the hasura-firebase-auth webhook server
graphql-engine --database-url <DB URL> serve --admin-secret <ADMIN_SECRET_KEY> --auth-hook localhost:8081
-
Launch the webhook container:
$ curl https://raw.githubusercontent.com/sdil/hasura-firebase-auth-webhook/master/example/docker-compose/docker-compose.yaml -o docker-compose.yaml $ docker-compose up -d
-
Test the webhook server
-
Test the GraphQL operation
-
Launch the Kubernetes resources:
$ kubectl create -f https://raw.githubusercontent.com/sdil/hasura-firebase-auth-webhook/master/example/kubernetes/kubernetes.yaml
- Write a comprehensive unit tests
- Perform a benchmark & performance test
- Handle exceptions
- Add Kubernetes manifest example
- Write manifests for Kubernetes and Heroku deployment script to ease the adoption
- Cache the request so that it doesn't stress Firebase auth too much
- Query Hasura (with admin secret) to get the user's role from database
I got this error ....
You're not mounting the service-account.json file in the container.
