这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 5 additions & 22 deletions community/boilerplates/auth-webhooks/nodejs-express/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This is a sample auth webhook for authenticating requests to the Hasura GraphQL engine.

It has boilerplate code written for auth0 and firebase auth. There is also a generic sample handler in `server.js` where you can handle your custom auth providers.
It has boilerplate code written for firebase auth. There is also a generic sample handler in `server.js` where you can handle your custom auth providers.

## Quick deploy

Expand All @@ -13,9 +13,8 @@ It has boilerplate code written for auth0 and firebase auth. There is also a gen

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/hasura/sample-auth-webhook)

2. Once it is deployed, go to `Manage App > Settings` of your app and set the following environment variables if you want to use the associated providers.
2. Once it is deployed, go to `Manage App > Settings` of your app and set the following environment variables if you want to use Firebase.

- **AUTH_ZERO_DOMAIN**: Example `test.auth0.com`
- **FIREBASE_CONFIG**: Copy the contents of your serviceAccount JSON file for this field. Example:
```
{
Expand Down Expand Up @@ -44,7 +43,6 @@ git clone https://github.com/hasura/graphql-engine
cd graphql-engine/community/boilerplates/auth-webhooks/nodejs-express
npm install -g now
now -e \
AUTH_ZERO_DOMAIN='test.auth0.com' -e \
FIREBASE_CONFIG='{
"type": "service_account",
"project_id": "testapp-2222",
Expand All @@ -59,11 +57,10 @@ FIREBASE_CONFIG='{
}'
```

If you are not using an auth provider, you need not enter the environment variable associated with it. For example, if you are not using firebase, the command last command you should run is,
If you are not using an auth provider, you need not enter the environment variable associated with it. For example, if you are not using firebase, the last command you should run is,

```bash
$ now -e \
AUTH_ZERO_DOMAIN='test.auth0.com'
$ now
```

### Deploy with Glitch
Expand All @@ -75,7 +72,6 @@ $ now -e \
2. Add the following environment variables in the `.env` file on glitch.

```env
AUTH_ZERO_DOMAIN='test.auth0.com'
FIREBASE_CONFIG='{
"type": "service_account",
"project_id": "testapp-2222",
Expand All @@ -90,28 +86,15 @@ $ now -e \
}'
```

If you are not using an auth provider, you need not enter the environment variable associated with it. For example, if you are not using firebase, the command last command you should run is,
If you are not using an auth provider, you need not enter the environment variable associated with it.

```env
AUTH_ZERO_DOMAIN='test.auth0.com'
```

## Usage with Hasura GraphQL engine

Once you have deployed this webhook, you can use it along with the GraphQL engine. You have to set the webhook URL as an environment variable in the docker container that runs the GraphQL engine.

*[Read the docs](https://docs.hasura.io/1.0/graphql/manual/auth/webhook.html).*

### Auth0

Send the auth0 `access_token` as a header while making queries to the `graphql-engine`.

```JSON
{
"Authorization": "Bearer <access_token>"
}
```

### Firebase

Send the firebase `id_token` as a header while making queries to the `graphql-engine`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"auth",
"webhook"
],
"repository": "https://github.com/hasura/sample-auth-webhook",
"repository": "https://github.com/hasura/sample-auth-webhook"
}

This file was deleted.

6 changes: 0 additions & 6 deletions community/boilerplates/auth-webhooks/nodejs-express/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ app.get('/simple/webhook', (request, response) => {
var firebaseRouter = require('./firebase/firebaseHandler');
app.use('/firebase', firebaseRouter);

// Auth0 handler
var auth0Router = require('./auth0/auth0Handler');
app.use('/auth0', auth0Router);



// listen for requests :)
var listener = app.listen(port, function () {
console.log('Your app is listening on port ' + port);
Expand Down
6 changes: 0 additions & 6 deletions community/examples/todo-auth0/.dockerignore

This file was deleted.

15 changes: 0 additions & 15 deletions community/examples/todo-auth0/.gitignore

This file was deleted.

32 changes: 0 additions & 32 deletions community/examples/todo-auth0/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions community/examples/todo-auth0/auth-webhook/constants.js

This file was deleted.

Loading