mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
remove auth0 webhook ref from docs and community (#1341)
This commit is contained in:
parent
e9121a903f
commit
a9e2326ea8
@ -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
|
||||
|
||||
@ -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:
|
||||
```
|
||||
{
|
||||
@ -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",
|
||||
@ -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
|
||||
@ -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",
|
||||
@ -90,11 +86,8 @@ $ 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
|
||||
|
||||
@ -102,16 +95,6 @@ Once you have deployed this webhook, you can use it along with the GraphQL engin
|
||||
|
||||
*[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`.
|
||||
|
@ -9,5 +9,5 @@
|
||||
"auth",
|
||||
"webhook"
|
||||
],
|
||||
"repository": "https://github.com/hasura/sample-auth-webhook",
|
||||
"repository": "https://github.com/hasura/sample-auth-webhook"
|
||||
}
|
||||
|
@ -1,60 +0,0 @@
|
||||
var express = require('express');
|
||||
var auth0Router = express.Router();
|
||||
var requestClient = require('request');
|
||||
var auth0Domain = process.env.AUTH_ZERO_DOMAIN;
|
||||
/*
|
||||
Auth webhook handler for auth0
|
||||
Flow:
|
||||
1) Expects access_token to be sent as 'Authorization: Bearer <access-token>
|
||||
2) Verified access_token by fetching /userinfo endpoint from auth0
|
||||
|
||||
Usage:
|
||||
1) From your application, when you call Hasura's GraphQL APIs remember to send the access_token from auth0 as an authorization header
|
||||
2) Replace the url (https://test-hasura.auth0.com/userinfo) in the code below with your own auth0 app url
|
||||
*/
|
||||
|
||||
auth0Router.route('/webhook').get((request, response) => {
|
||||
// Throw 500 if auth0 domain is not configured
|
||||
if (!auth0Domain) {
|
||||
response.status(500).send('Auth0 domain not configured');
|
||||
return;
|
||||
}
|
||||
|
||||
var token = request.get('Authorization');
|
||||
|
||||
if (!token) {
|
||||
response.json({'x-hasura-role': 'anonymous'});
|
||||
return;
|
||||
} else {
|
||||
// Fetch information about this user from
|
||||
// auth0 to validate this token
|
||||
// NOTE: Replace the URL with your own auth0 app url
|
||||
var options = {
|
||||
url: `https://${auth0Domain}/userinfo`,
|
||||
headers: {
|
||||
Authorization: token,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
};
|
||||
|
||||
requestClient(options, (err, res, body) => {
|
||||
if (!err && res.statusCode == 200) {
|
||||
var userInfo = JSON.parse(body);
|
||||
console.log(userInfo); //debug
|
||||
var hasuraVariables = {
|
||||
'X-Hasura-User-Id': userInfo.sub,
|
||||
'X-Hasura-Role': 'user'
|
||||
};
|
||||
console.log(hasuraVariables); // For debug
|
||||
response.json(hasuraVariables);
|
||||
} else {
|
||||
// Error response from auth0
|
||||
console.log(err, res, body);
|
||||
response.json({'x-hasura-role': 'anonymous'});
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = auth0Router;
|
@ -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);
|
||||
|
@ -1,6 +0,0 @@
|
||||
package-lock.json
|
||||
node_modules
|
||||
.gitignore
|
||||
exec.sh
|
||||
exec.ps1
|
||||
README.md
|
15
community/examples/todo-auth0/.gitignore
vendored
15
community/examples/todo-auth0/.gitignore
vendored
@ -1,15 +0,0 @@
|
||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
node_modules
|
||||
|
||||
# testing
|
||||
coverage
|
||||
|
||||
# production
|
||||
build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env
|
||||
npm-debug.log
|
@ -1,32 +0,0 @@
|
||||
# Todo app using Hasura GraphQL Engine, Heroku Postgres and Auth0
|
||||
|
||||
* STEP 1: Set auth0 domain
|
||||
|
||||
Set your auth0 domain in `auth-webhook/constants.js`.
|
||||
Also, allow callbacks for `http://localhost:3000/callback` in your `auth0` dashboard.
|
||||
|
||||
* STEP 2: Deploy the auth Webhook (using ngrok, glitch, Heroku or whatever)
|
||||
|
||||
[![glitch-deploy-button](https://raw.githubusercontent.com/hasura/sample-auth-webhook/master/assets/deploy-glitch.png)](https://glitch.com/edit/#!/thundering-brick)
|
||||
|
||||
* STEP 3: Start GraphQL engine with the auth-hook as the webhook URL and access key of your choice
|
||||
|
||||
Deploy GraphQL engine to Heroku if you do not have it deployed anywhere.
|
||||
|
||||
[![Deploy to heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/hasura/graphql-engine-heroku)
|
||||
|
||||
* STEP 4: Apply the migrations
|
||||
|
||||
- Add your database URL and access key in `hasura-graphql-engine/config.yaml`
|
||||
- Run `hasura migrate apply` to create the required tables and permissions for the todo app
|
||||
|
||||
* Step 5: Set React app variables
|
||||
|
||||
Set `auth0 domain`, `auth0 client ID` and the `GraphQL Engine URL` in `todo-app/src/constants.js`
|
||||
|
||||
* Step 6: Run the React app
|
||||
|
||||
Run `npm start` from the `todo-app` directory to start the TODO app.
|
||||
|
||||
> The app runs on port 3000 by default. You can change the port number, but you will also have to reconfigure the callback.
|
||||
|
@ -1,3 +0,0 @@
|
||||
const auth0Domain = "wawhal.auth0.com";
|
||||
|
||||
module.exports = auth0Domain;
|
@ -1,672 +0,0 @@
|
||||
{
|
||||
"name": "auth-webhook",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"accepts": {
|
||||
"version": "1.3.5",
|
||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz",
|
||||
"integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=",
|
||||
"requires": {
|
||||
"mime-types": "~2.1.18",
|
||||
"negotiator": "0.6.1"
|
||||
}
|
||||
},
|
||||
"ajv": {
|
||||
"version": "5.5.2",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
|
||||
"integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
|
||||
"requires": {
|
||||
"co": "^4.6.0",
|
||||
"fast-deep-equal": "^1.0.0",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
"json-schema-traverse": "^0.3.0"
|
||||
}
|
||||
},
|
||||
"array-flatten": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
|
||||
},
|
||||
"asn1": {
|
||||
"version": "0.2.3",
|
||||
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz",
|
||||
"integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y="
|
||||
},
|
||||
"assert-plus": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
|
||||
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="
|
||||
},
|
||||
"asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
|
||||
},
|
||||
"aws-sign2": {
|
||||
"version": "0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
|
||||
"integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg="
|
||||
},
|
||||
"aws4": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz",
|
||||
"integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w=="
|
||||
},
|
||||
"bcrypt-pbkdf": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz",
|
||||
"integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"tweetnacl": "^0.14.3"
|
||||
}
|
||||
},
|
||||
"body-parser": {
|
||||
"version": "1.18.2",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz",
|
||||
"integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=",
|
||||
"requires": {
|
||||
"bytes": "3.0.0",
|
||||
"content-type": "~1.0.4",
|
||||
"debug": "2.6.9",
|
||||
"depd": "~1.1.1",
|
||||
"http-errors": "~1.6.2",
|
||||
"iconv-lite": "0.4.19",
|
||||
"on-finished": "~2.3.0",
|
||||
"qs": "6.5.1",
|
||||
"raw-body": "2.3.2",
|
||||
"type-is": "~1.6.15"
|
||||
}
|
||||
},
|
||||
"bytes": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
|
||||
"integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg="
|
||||
},
|
||||
"caseless": {
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
|
||||
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
|
||||
},
|
||||
"co": {
|
||||
"version": "4.6.0",
|
||||
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
|
||||
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ="
|
||||
},
|
||||
"combined-stream": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz",
|
||||
"integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=",
|
||||
"requires": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"content-disposition": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz",
|
||||
"integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ="
|
||||
},
|
||||
"content-type": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
|
||||
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
|
||||
},
|
||||
"cookie": {
|
||||
"version": "0.3.1",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
|
||||
"integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
|
||||
},
|
||||
"cookie-signature": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
||||
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
|
||||
},
|
||||
"dashdash": {
|
||||
"version": "1.14.1",
|
||||
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
|
||||
"integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
|
||||
"requires": {
|
||||
"assert-plus": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
|
||||
},
|
||||
"depd": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
|
||||
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
|
||||
},
|
||||
"destroy": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
|
||||
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
|
||||
},
|
||||
"ecc-jsbn": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz",
|
||||
"integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"jsbn": "~0.1.0"
|
||||
}
|
||||
},
|
||||
"ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
||||
},
|
||||
"encodeurl": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
|
||||
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
|
||||
},
|
||||
"escape-html": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
|
||||
},
|
||||
"etag": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
||||
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
|
||||
},
|
||||
"express": {
|
||||
"version": "4.16.3",
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz",
|
||||
"integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=",
|
||||
"requires": {
|
||||
"accepts": "~1.3.5",
|
||||
"array-flatten": "1.1.1",
|
||||
"body-parser": "1.18.2",
|
||||
"content-disposition": "0.5.2",
|
||||
"content-type": "~1.0.4",
|
||||
"cookie": "0.3.1",
|
||||
"cookie-signature": "1.0.6",
|
||||
"debug": "2.6.9",
|
||||
"depd": "~1.1.2",
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"finalhandler": "1.1.1",
|
||||
"fresh": "0.5.2",
|
||||
"merge-descriptors": "1.0.1",
|
||||
"methods": "~1.1.2",
|
||||
"on-finished": "~2.3.0",
|
||||
"parseurl": "~1.3.2",
|
||||
"path-to-regexp": "0.1.7",
|
||||
"proxy-addr": "~2.0.3",
|
||||
"qs": "6.5.1",
|
||||
"range-parser": "~1.2.0",
|
||||
"safe-buffer": "5.1.1",
|
||||
"send": "0.16.2",
|
||||
"serve-static": "1.13.2",
|
||||
"setprototypeof": "1.1.0",
|
||||
"statuses": "~1.4.0",
|
||||
"type-is": "~1.6.16",
|
||||
"utils-merge": "1.0.1",
|
||||
"vary": "~1.1.2"
|
||||
}
|
||||
},
|
||||
"extend": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz",
|
||||
"integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ="
|
||||
},
|
||||
"extsprintf": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
|
||||
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
|
||||
},
|
||||
"fast-deep-equal": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
|
||||
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ="
|
||||
},
|
||||
"fast-json-stable-stringify": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
|
||||
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="
|
||||
},
|
||||
"finalhandler": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
|
||||
"integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==",
|
||||
"requires": {
|
||||
"debug": "2.6.9",
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"on-finished": "~2.3.0",
|
||||
"parseurl": "~1.3.2",
|
||||
"statuses": "~1.4.0",
|
||||
"unpipe": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"forever-agent": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
|
||||
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE="
|
||||
},
|
||||
"form-data": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz",
|
||||
"integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=",
|
||||
"requires": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "1.0.6",
|
||||
"mime-types": "^2.1.12"
|
||||
}
|
||||
},
|
||||
"forwarded": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
|
||||
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
|
||||
},
|
||||
"fresh": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
||||
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
|
||||
},
|
||||
"getpass": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
|
||||
"integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
|
||||
"requires": {
|
||||
"assert-plus": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"har-schema": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
|
||||
"integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI="
|
||||
},
|
||||
"har-validator": {
|
||||
"version": "5.0.3",
|
||||
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
|
||||
"integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=",
|
||||
"requires": {
|
||||
"ajv": "^5.1.0",
|
||||
"har-schema": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"http-errors": {
|
||||
"version": "1.6.3",
|
||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
|
||||
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
|
||||
"requires": {
|
||||
"depd": "~1.1.2",
|
||||
"inherits": "2.0.3",
|
||||
"setprototypeof": "1.1.0",
|
||||
"statuses": ">= 1.4.0 < 2"
|
||||
}
|
||||
},
|
||||
"http-signature": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
|
||||
"integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
|
||||
"requires": {
|
||||
"assert-plus": "^1.0.0",
|
||||
"jsprim": "^1.2.2",
|
||||
"sshpk": "^1.7.0"
|
||||
}
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.19",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz",
|
||||
"integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ=="
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
||||
},
|
||||
"ipaddr.js": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz",
|
||||
"integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs="
|
||||
},
|
||||
"is-typedarray": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
|
||||
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
|
||||
},
|
||||
"isstream": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
|
||||
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
|
||||
},
|
||||
"jsbn": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
|
||||
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=",
|
||||
"optional": true
|
||||
},
|
||||
"json-schema": {
|
||||
"version": "0.2.3",
|
||||
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
|
||||
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM="
|
||||
},
|
||||
"json-schema-traverse": {
|
||||
"version": "0.3.1",
|
||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
|
||||
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A="
|
||||
},
|
||||
"json-stringify-safe": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
|
||||
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
|
||||
},
|
||||
"jsprim": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
|
||||
"integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
|
||||
"requires": {
|
||||
"assert-plus": "1.0.0",
|
||||
"extsprintf": "1.3.0",
|
||||
"json-schema": "0.2.3",
|
||||
"verror": "1.10.0"
|
||||
}
|
||||
},
|
||||
"media-typer": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
|
||||
},
|
||||
"merge-descriptors": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
||||
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
|
||||
},
|
||||
"methods": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
||||
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
|
||||
},
|
||||
"mime": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz",
|
||||
"integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ=="
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz",
|
||||
"integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ=="
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.18",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz",
|
||||
"integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==",
|
||||
"requires": {
|
||||
"mime-db": "~1.33.0"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
},
|
||||
"negotiator": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz",
|
||||
"integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk="
|
||||
},
|
||||
"oauth-sign": {
|
||||
"version": "0.8.2",
|
||||
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz",
|
||||
"integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM="
|
||||
},
|
||||
"on-finished": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
|
||||
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
|
||||
"requires": {
|
||||
"ee-first": "1.1.1"
|
||||
}
|
||||
},
|
||||
"parseurl": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz",
|
||||
"integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M="
|
||||
},
|
||||
"path-to-regexp": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
||||
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
|
||||
},
|
||||
"performance-now": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
|
||||
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
|
||||
},
|
||||
"proxy-addr": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz",
|
||||
"integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==",
|
||||
"requires": {
|
||||
"forwarded": "~0.1.2",
|
||||
"ipaddr.js": "1.6.0"
|
||||
}
|
||||
},
|
||||
"punycode": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
|
||||
"integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4="
|
||||
},
|
||||
"qs": {
|
||||
"version": "6.5.1",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz",
|
||||
"integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A=="
|
||||
},
|
||||
"range-parser": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
|
||||
"integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4="
|
||||
},
|
||||
"raw-body": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz",
|
||||
"integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=",
|
||||
"requires": {
|
||||
"bytes": "3.0.0",
|
||||
"http-errors": "1.6.2",
|
||||
"iconv-lite": "0.4.19",
|
||||
"unpipe": "1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"depd": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz",
|
||||
"integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k="
|
||||
},
|
||||
"http-errors": {
|
||||
"version": "1.6.2",
|
||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz",
|
||||
"integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=",
|
||||
"requires": {
|
||||
"depd": "1.1.1",
|
||||
"inherits": "2.0.3",
|
||||
"setprototypeof": "1.0.3",
|
||||
"statuses": ">= 1.3.1 < 2"
|
||||
}
|
||||
},
|
||||
"setprototypeof": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz",
|
||||
"integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ="
|
||||
}
|
||||
}
|
||||
},
|
||||
"request": {
|
||||
"version": "2.87.0",
|
||||
"resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz",
|
||||
"integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==",
|
||||
"requires": {
|
||||
"aws-sign2": "~0.7.0",
|
||||
"aws4": "^1.6.0",
|
||||
"caseless": "~0.12.0",
|
||||
"combined-stream": "~1.0.5",
|
||||
"extend": "~3.0.1",
|
||||
"forever-agent": "~0.6.1",
|
||||
"form-data": "~2.3.1",
|
||||
"har-validator": "~5.0.3",
|
||||
"http-signature": "~1.2.0",
|
||||
"is-typedarray": "~1.0.0",
|
||||
"isstream": "~0.1.2",
|
||||
"json-stringify-safe": "~5.0.1",
|
||||
"mime-types": "~2.1.17",
|
||||
"oauth-sign": "~0.8.2",
|
||||
"performance-now": "^2.1.0",
|
||||
"qs": "~6.5.1",
|
||||
"safe-buffer": "^5.1.1",
|
||||
"tough-cookie": "~2.3.3",
|
||||
"tunnel-agent": "^0.6.0",
|
||||
"uuid": "^3.1.0"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
|
||||
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"send": {
|
||||
"version": "0.16.2",
|
||||
"resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz",
|
||||
"integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==",
|
||||
"requires": {
|
||||
"debug": "2.6.9",
|
||||
"depd": "~1.1.2",
|
||||
"destroy": "~1.0.4",
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"fresh": "0.5.2",
|
||||
"http-errors": "~1.6.2",
|
||||
"mime": "1.4.1",
|
||||
"ms": "2.0.0",
|
||||
"on-finished": "~2.3.0",
|
||||
"range-parser": "~1.2.0",
|
||||
"statuses": "~1.4.0"
|
||||
}
|
||||
},
|
||||
"serve-static": {
|
||||
"version": "1.13.2",
|
||||
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz",
|
||||
"integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==",
|
||||
"requires": {
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"parseurl": "~1.3.2",
|
||||
"send": "0.16.2"
|
||||
}
|
||||
},
|
||||
"setprototypeof": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
|
||||
"integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
|
||||
},
|
||||
"sshpk": {
|
||||
"version": "1.14.2",
|
||||
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz",
|
||||
"integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=",
|
||||
"requires": {
|
||||
"asn1": "~0.2.3",
|
||||
"assert-plus": "^1.0.0",
|
||||
"bcrypt-pbkdf": "^1.0.0",
|
||||
"dashdash": "^1.12.0",
|
||||
"ecc-jsbn": "~0.1.1",
|
||||
"getpass": "^0.1.1",
|
||||
"jsbn": "~0.1.0",
|
||||
"safer-buffer": "^2.0.2",
|
||||
"tweetnacl": "~0.14.0"
|
||||
}
|
||||
},
|
||||
"statuses": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
|
||||
"integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew=="
|
||||
},
|
||||
"tough-cookie": {
|
||||
"version": "2.3.4",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz",
|
||||
"integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==",
|
||||
"requires": {
|
||||
"punycode": "^1.4.1"
|
||||
}
|
||||
},
|
||||
"tunnel-agent": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
|
||||
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
|
||||
"requires": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"tweetnacl": {
|
||||
"version": "0.14.5",
|
||||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
|
||||
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
|
||||
"optional": true
|
||||
},
|
||||
"type-is": {
|
||||
"version": "1.6.16",
|
||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz",
|
||||
"integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==",
|
||||
"requires": {
|
||||
"media-typer": "0.3.0",
|
||||
"mime-types": "~2.1.18"
|
||||
}
|
||||
},
|
||||
"unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
|
||||
},
|
||||
"utils-merge": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
||||
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
|
||||
},
|
||||
"uuid": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz",
|
||||
"integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA=="
|
||||
},
|
||||
"vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
|
||||
},
|
||||
"verror": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
|
||||
"integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
|
||||
"requires": {
|
||||
"assert-plus": "^1.0.0",
|
||||
"core-util-is": "1.0.2",
|
||||
"extsprintf": "^1.2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
{
|
||||
"name": "auth-webhook",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "server.js",
|
||||
"dependencies": {
|
||||
"express": "^4.16.3",
|
||||
"request": "^2.87.0"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node server.js"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
const express = require('express');
|
||||
const request = require('request');
|
||||
const app = express();
|
||||
|
||||
const authDomain = require('./constants.js');
|
||||
|
||||
if (!authDomain) {
|
||||
console.log('Please set your auth0 domain as an environment variable: AUTH_ZERO_DOMAIN');
|
||||
return;
|
||||
}
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
const authHeaders = req.get('authorization');
|
||||
const options = {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Authorization': authHeaders
|
||||
},
|
||||
url: `https://${authDomain}/userinfo`
|
||||
};
|
||||
request(options, (err, response, body) => {
|
||||
console.log(response.statusCode);
|
||||
console.log(body);
|
||||
if (response.statusCode !== 200 || err){
|
||||
console.log(err);
|
||||
res.status(401);
|
||||
res.send(JSON.stringify({'x-hasura-role': 'anonymous'}));
|
||||
return;
|
||||
} else {
|
||||
respObj = JSON.parse(body);
|
||||
res.status(200);
|
||||
res.send(JSON.stringify({
|
||||
'x-hasura-user-id': respObj.sub,
|
||||
'x-hasura-role': 'user'
|
||||
}));
|
||||
return;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
app.listen(3002, () => console.log('Example app listening on port 3002!'))
|
@ -1 +0,0 @@
|
||||
endpoint: http://localhost:8080
|
@ -1,72 +0,0 @@
|
||||
--
|
||||
-- PostgreSQL database dump
|
||||
--
|
||||
|
||||
-- Dumped from database version 10.5 (Debian 10.5-1.pgdg90+1)
|
||||
-- Dumped by pg_dump version 10.5 (Ubuntu 10.5-0ubuntu0.18.04)
|
||||
|
||||
SET statement_timeout = 0;
|
||||
SET lock_timeout = 0;
|
||||
SET idle_in_transaction_session_timeout = 0;
|
||||
SET client_encoding = 'UTF8';
|
||||
SET standard_conforming_strings = on;
|
||||
SELECT pg_catalog.set_config('search_path', '', false);
|
||||
SET check_function_bodies = false;
|
||||
SET client_min_messages = warning;
|
||||
SET row_security = off;
|
||||
|
||||
SET default_tablespace = '';
|
||||
|
||||
SET default_with_oids = false;
|
||||
|
||||
--
|
||||
-- Name: todo; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.todo (
|
||||
id integer NOT NULL,
|
||||
task text NOT NULL,
|
||||
completed boolean NOT NULL,
|
||||
user_id text NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: todo_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.todo_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: todo_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.todo_id_seq OWNED BY public.todo.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: todo id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.todo ALTER COLUMN id SET DEFAULT nextval('public.todo_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: todo todo_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.todo
|
||||
ADD CONSTRAINT todo_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- PostgreSQL database dump complete
|
||||
--
|
||||
|
@ -1,44 +0,0 @@
|
||||
- type: replace_metadata
|
||||
args:
|
||||
query_templates: []
|
||||
tables:
|
||||
- array_relationships: []
|
||||
delete_permissions:
|
||||
- comment: null
|
||||
permission:
|
||||
filter:
|
||||
user_id:
|
||||
_eq: X-HASURA-USER-ID
|
||||
role: user
|
||||
event_triggers: []
|
||||
insert_permissions:
|
||||
- comment: null
|
||||
permission:
|
||||
check:
|
||||
user_id:
|
||||
_eq: X-HASURA-USER-ID
|
||||
role: user
|
||||
object_relationships: []
|
||||
select_permissions:
|
||||
- comment: null
|
||||
permission:
|
||||
columns:
|
||||
- task
|
||||
- completed
|
||||
- user_id
|
||||
- id
|
||||
filter:
|
||||
user_id:
|
||||
_eq: X-HASURA-USER-ID
|
||||
role: user
|
||||
table: todo
|
||||
update_permissions:
|
||||
- comment: null
|
||||
permission:
|
||||
columns:
|
||||
- completed
|
||||
filter:
|
||||
user_id:
|
||||
_eq: X-HASURA-USER-ID
|
||||
role: user
|
||||
|
@ -1,12 +0,0 @@
|
||||
FROM node:8.7-alpine
|
||||
|
||||
WORKDIR /home/app
|
||||
|
||||
RUN npm install -g create-react-app
|
||||
ADD package.json /home/app
|
||||
RUN npm install
|
||||
ADD . /home/app
|
||||
|
||||
CMD ["npm", "start"]
|
||||
|
||||
EXPOSE 3000
|
@ -1,2 +0,0 @@
|
||||
docker build -t auth0-react-01-login .
|
||||
docker run -p 3000:3000 -it auth0-react-01-login
|
@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
docker build -t auth0-react-01-login .
|
||||
docker run -p 3000:3000 -it auth0-react-01-login
|
9285
community/examples/todo-auth0/todo-app/package-lock.json
generated
9285
community/examples/todo-auth0/todo-app/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,28 +0,0 @@
|
||||
{
|
||||
"name": "centralized-login",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"react-scripts": "0.9.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"apollo-boost": "^0.1.10",
|
||||
"apollo-link-context": "^1.0.8",
|
||||
"auth0-js": "^9.0.0",
|
||||
"bootstrap": "^3.3.7",
|
||||
"graphql": "^0.13.2",
|
||||
"graphql-tag": "^2.9.2",
|
||||
"react": "^15.5.4",
|
||||
"react-apollo": "^2.1.6",
|
||||
"react-bootstrap": "^0.31.0",
|
||||
"react-dom": "^15.5.4",
|
||||
"react-router": "^4.1.1",
|
||||
"react-router-dom": "^4.1.1"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test --env=jsdom",
|
||||
"eject": "react-scripts eject"
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 24 KiB |
@ -1,31 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tag above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>Todo app - Hasura & Auth0</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start`.
|
||||
To create a production bundle, use `npm run build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
@ -1,13 +0,0 @@
|
||||
.btn-margin {
|
||||
margin: 7px 3px;
|
||||
}
|
||||
|
||||
.center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding-top: 50px;
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
import React, { Component } from 'react';
|
||||
import { Navbar, Button } from 'react-bootstrap';
|
||||
import './App.css';
|
||||
|
||||
|
||||
|
||||
class App extends Component {
|
||||
goTo(route) {
|
||||
this.props.history.replace(`/${route}`)
|
||||
}
|
||||
|
||||
login() {
|
||||
this.props.auth.login();
|
||||
}
|
||||
|
||||
logout() {
|
||||
this.props.auth.logout();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (this.props.auth.isAuthenticated()) {
|
||||
this.props.history.push('/home');
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { isAuthenticated } = this.props.auth;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Navbar fluid>
|
||||
<Navbar.Header>
|
||||
<Navbar.Brand>
|
||||
<a href="#">Auth0 - React</a>
|
||||
</Navbar.Brand>
|
||||
<Button
|
||||
bsStyle="primary"
|
||||
className="btn-margin"
|
||||
onClick={this.goTo.bind(this, 'home')}
|
||||
>
|
||||
Home
|
||||
</Button>
|
||||
{
|
||||
!isAuthenticated() && (
|
||||
<Button
|
||||
id="qsLoginBtn"
|
||||
bsStyle="primary"
|
||||
className="btn-margin"
|
||||
onClick={this.login.bind(this)}
|
||||
>
|
||||
Log In
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
{
|
||||
isAuthenticated() && (
|
||||
<Button
|
||||
id="qsLogoutBtn"
|
||||
bsStyle="primary"
|
||||
className="btn-margin"
|
||||
onClick={this.logout.bind(this)}
|
||||
>
|
||||
Log Out
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
</Navbar.Header>
|
||||
</Navbar>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default App;
|
@ -1,8 +0,0 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import App from './App';
|
||||
|
||||
it('renders without crashing', () => {
|
||||
const div = document.createElement('div');
|
||||
ReactDOM.render(<App />, div);
|
||||
});
|
@ -1,67 +0,0 @@
|
||||
import history from '../history';
|
||||
import auth0 from 'auth0-js';
|
||||
import { AUTH_CONFIG } from './auth0-variables';
|
||||
|
||||
|
||||
export default class Auth {
|
||||
auth0 = new auth0.WebAuth({
|
||||
domain: AUTH_CONFIG.domain,
|
||||
clientID: AUTH_CONFIG.clientId,
|
||||
redirectUri: AUTH_CONFIG.callbackUrl,
|
||||
audience: `https://${AUTH_CONFIG.domain}/userinfo`,
|
||||
responseType: 'token id_token',
|
||||
scope: 'openid'
|
||||
});
|
||||
|
||||
constructor() {
|
||||
this.login = this.login.bind(this);
|
||||
this.logout = this.logout.bind(this);
|
||||
this.handleAuthentication = this.handleAuthentication.bind(this);
|
||||
this.isAuthenticated = this.isAuthenticated.bind(this);
|
||||
}
|
||||
|
||||
login() {
|
||||
this.auth0.authorize();
|
||||
}
|
||||
|
||||
handleAuthentication() {
|
||||
this.auth0.parseHash((err, authResult) => {
|
||||
if (authResult && authResult.accessToken && authResult.idToken) {
|
||||
this.setSession(authResult);
|
||||
history.replace('/home');
|
||||
} else if (err) {
|
||||
history.replace('/home');
|
||||
console.error(err);
|
||||
alert(`Error: ${err.error}. Check the console for further details.`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setSession(authResult) {
|
||||
// Set the time that the access token will expire at
|
||||
let expiresAt = JSON.stringify((authResult.expiresIn * 1000) + new Date().getTime());
|
||||
localStorage.setItem('auth0:access_token', authResult.accessToken);
|
||||
localStorage.setItem('auth0:id_token', authResult.idToken);
|
||||
localStorage.setItem('auth0:expires_at', expiresAt);
|
||||
localStorage.setItem('auth0:id_token:sub', authResult.idTokenPayload.sub)
|
||||
// navigate to the home route
|
||||
history.replace('/home');
|
||||
}
|
||||
|
||||
logout() {
|
||||
// Clear access token and ID token from local storage
|
||||
localStorage.removeItem('auth0:access_token');
|
||||
localStorage.removeItem('auth0:id_token');
|
||||
localStorage.removeItem('auth0:expires_at');
|
||||
localStorage.removeItem('auth0:id_token:sub');
|
||||
// navigate to the home route
|
||||
history.replace('/home');
|
||||
}
|
||||
|
||||
isAuthenticated() {
|
||||
// Check whether the current time is past the
|
||||
// access token's expiry time
|
||||
let expiresAt = JSON.parse(localStorage.getItem('auth0:expires_at'));
|
||||
return new Date().getTime() < expiresAt;
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
import {
|
||||
authDomain,
|
||||
authClientId
|
||||
} from '../constants';
|
||||
|
||||
export const AUTH_CONFIG = {
|
||||
domain: authDomain,
|
||||
clientId: authClientId,
|
||||
callbackUrl: 'http://localhost:3000/callback'
|
||||
};
|
@ -1,27 +0,0 @@
|
||||
import React, { Component } from 'react';
|
||||
import loading from './loading.svg';
|
||||
|
||||
class Callback extends Component {
|
||||
render() {
|
||||
const style = {
|
||||
position: 'absolute',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
height: '100vh',
|
||||
width: '100vw',
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
backgroundColor: 'white',
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={style}>
|
||||
<img src={loading} alt="loading"/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Callback;
|
@ -1 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><svg width='120px' height='120px' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="uil-ring"><rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect><defs><filter id="uil-ring-shadow" x="-100%" y="-100%" width="300%" height="300%"><feOffset result="offOut" in="SourceGraphic" dx="0" dy="0"></feOffset><feGaussianBlur result="blurOut" in="offOut" stdDeviation="0"></feGaussianBlur><feBlend in="SourceGraphic" in2="blurOut" mode="normal"></feBlend></filter></defs><path d="M10,50c0,0,0,0.5,0.1,1.4c0,0.5,0.1,1,0.2,1.7c0,0.3,0.1,0.7,0.1,1.1c0.1,0.4,0.1,0.8,0.2,1.2c0.2,0.8,0.3,1.8,0.5,2.8 c0.3,1,0.6,2.1,0.9,3.2c0.3,1.1,0.9,2.3,1.4,3.5c0.5,1.2,1.2,2.4,1.8,3.7c0.3,0.6,0.8,1.2,1.2,1.9c0.4,0.6,0.8,1.3,1.3,1.9 c1,1.2,1.9,2.6,3.1,3.7c2.2,2.5,5,4.7,7.9,6.7c3,2,6.5,3.4,10.1,4.6c3.6,1.1,7.5,1.5,11.2,1.6c4-0.1,7.7-0.6,11.3-1.6 c3.6-1.2,7-2.6,10-4.6c3-2,5.8-4.2,7.9-6.7c1.2-1.2,2.1-2.5,3.1-3.7c0.5-0.6,0.9-1.3,1.3-1.9c0.4-0.6,0.8-1.3,1.2-1.9 c0.6-1.3,1.3-2.5,1.8-3.7c0.5-1.2,1-2.4,1.4-3.5c0.3-1.1,0.6-2.2,0.9-3.2c0.2-1,0.4-1.9,0.5-2.8c0.1-0.4,0.1-0.8,0.2-1.2 c0-0.4,0.1-0.7,0.1-1.1c0.1-0.7,0.1-1.2,0.2-1.7C90,50.5,90,50,90,50s0,0.5,0,1.4c0,0.5,0,1,0,1.7c0,0.3,0,0.7,0,1.1 c0,0.4-0.1,0.8-0.1,1.2c-0.1,0.9-0.2,1.8-0.4,2.8c-0.2,1-0.5,2.1-0.7,3.3c-0.3,1.2-0.8,2.4-1.2,3.7c-0.2,0.7-0.5,1.3-0.8,1.9 c-0.3,0.7-0.6,1.3-0.9,2c-0.3,0.7-0.7,1.3-1.1,2c-0.4,0.7-0.7,1.4-1.2,2c-1,1.3-1.9,2.7-3.1,4c-2.2,2.7-5,5-8.1,7.1 c-0.8,0.5-1.6,1-2.4,1.5c-0.8,0.5-1.7,0.9-2.6,1.3L66,87.7l-1.4,0.5c-0.9,0.3-1.8,0.7-2.8,1c-3.8,1.1-7.9,1.7-11.8,1.8L47,90.8 c-1,0-2-0.2-3-0.3l-1.5-0.2l-0.7-0.1L41.1,90c-1-0.3-1.9-0.5-2.9-0.7c-0.9-0.3-1.9-0.7-2.8-1L34,87.7l-1.3-0.6 c-0.9-0.4-1.8-0.8-2.6-1.3c-0.8-0.5-1.6-1-2.4-1.5c-3.1-2.1-5.9-4.5-8.1-7.1c-1.2-1.2-2.1-2.7-3.1-4c-0.5-0.6-0.8-1.4-1.2-2 c-0.4-0.7-0.8-1.3-1.1-2c-0.3-0.7-0.6-1.3-0.9-2c-0.3-0.7-0.6-1.3-0.8-1.9c-0.4-1.3-0.9-2.5-1.2-3.7c-0.3-1.2-0.5-2.3-0.7-3.3 c-0.2-1-0.3-2-0.4-2.8c-0.1-0.4-0.1-0.8-0.1-1.2c0-0.4,0-0.7,0-1.1c0-0.7,0-1.2,0-1.7C10,50.5,10,50,10,50z" fill="#337ab7" filter="url(#uil-ring-shadow)"><animateTransform attributeName="transform" type="rotate" from="0 50 50" to="360 50 50" repeatCount="indefinite" dur="1s"></animateTransform></path></svg>
|
Before Width: | Height: | Size: 2.2 KiB |
@ -1,30 +0,0 @@
|
||||
import React, { Component } from 'react';
|
||||
import TodoComponent from '../Todo/TodoComponent';
|
||||
|
||||
class Home extends Component {
|
||||
login() {
|
||||
this.props.auth.login();
|
||||
}
|
||||
render() {
|
||||
const { isAuthenticated } = this.props.auth;
|
||||
if (isAuthenticated()) {
|
||||
return <TodoComponent />
|
||||
}
|
||||
return (
|
||||
<div className="container">
|
||||
<h4>
|
||||
You are not logged in! Please{' '}
|
||||
<a
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={this.login.bind(this)}
|
||||
>
|
||||
Log In
|
||||
</a>
|
||||
{' '}to continue.
|
||||
</h4>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Home;
|
@ -1,35 +0,0 @@
|
||||
.parentContainer .header {
|
||||
font-size: 40px;
|
||||
}
|
||||
.parentContainer input {
|
||||
padding: 10px;
|
||||
font-size: 16px;
|
||||
width: 90%;
|
||||
border: 2px solid #003399;
|
||||
}
|
||||
.parentContainer .todoList {
|
||||
list-style: none;
|
||||
padding-left: 0;
|
||||
margin-top: 50px;
|
||||
width: 93%;
|
||||
}
|
||||
.parentContainer .todoList li {
|
||||
color: #333;
|
||||
background-color: #dedede;
|
||||
padding: 15px;
|
||||
margin-bottom: 15px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.parentContainer .todoLabel {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.parentContainer .deleteLabel {
|
||||
color: #ff0000;
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
right: 0px;
|
||||
width: 150px;
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Mutation } from "react-apollo";
|
||||
import './Todo.css';
|
||||
|
||||
import {
|
||||
QUERY_TODO,
|
||||
MUTATION_TODO_UPDATE,
|
||||
MUTATION_TODO_DELETE
|
||||
} from './graphQueries/todoQueries';
|
||||
|
||||
const handleTodoToggle = (toggleTodo, todo) => {
|
||||
toggleTodo({
|
||||
variables: {
|
||||
todoId: todo.id,
|
||||
set: {
|
||||
completed: !todo.completed
|
||||
}
|
||||
},
|
||||
update: (cache, { data: { update_todo }}) => {
|
||||
const data = cache.readQuery({ query: QUERY_TODO })
|
||||
const toggledTodo = data.todo.find(t => t.id === todo.id)
|
||||
toggledTodo.completed = !todo.completed;
|
||||
cache.writeQuery({
|
||||
query: QUERY_TODO,
|
||||
data
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const handleTodoDelete = (deleteTodo, todo) => {
|
||||
deleteTodo({
|
||||
variables: {
|
||||
todoId: todo.id
|
||||
},
|
||||
update: (cache, { data: { update_todo }}) => {
|
||||
const data = cache.readQuery({ query: QUERY_TODO })
|
||||
data.todo = data.todo.filter(t => {
|
||||
return t.id !== todo.id
|
||||
})
|
||||
cache.writeQuery({
|
||||
query: QUERY_TODO,
|
||||
data
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const Todo = ({ todo }) => (
|
||||
<Mutation mutation={MUTATION_TODO_UPDATE}>
|
||||
{(updateTodo) => {
|
||||
return (
|
||||
<div className="parentContainer">
|
||||
<li className="todoItem"
|
||||
onClick={e => {
|
||||
handleTodoToggle(updateTodo, todo)
|
||||
}}>
|
||||
{
|
||||
todo.completed ?
|
||||
<strike className="todoLabel">{todo.task}</strike> :
|
||||
<label className="todoLabel">{todo.task}</label>
|
||||
}
|
||||
<Mutation mutation={MUTATION_TODO_DELETE}>
|
||||
{(deleteTodo) => {
|
||||
return (
|
||||
<label className="deleteLabel"
|
||||
onClick={e => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
handleTodoDelete(deleteTodo, todo)
|
||||
}}>
|
||||
Delete
|
||||
</label>
|
||||
)
|
||||
}}
|
||||
</Mutation>
|
||||
</li>
|
||||
</div>
|
||||
)
|
||||
}}
|
||||
</Mutation>
|
||||
)
|
||||
|
||||
export default Todo;
|
@ -1,18 +0,0 @@
|
||||
import React from 'react';
|
||||
import './Todo.css';
|
||||
import TodoInput from './TodoInput';
|
||||
import TodoList from './TodoList';
|
||||
|
||||
export default class TodoComponent extends React.Component {
|
||||
|
||||
render() {
|
||||
const userId = localStorage.getItem('auth0:id_token:sub');
|
||||
return (
|
||||
<div className="parentContainer">
|
||||
<h1 className="header">Todos</h1>
|
||||
<TodoInput userId={userId}/>
|
||||
<TodoList />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Mutation } from "react-apollo";
|
||||
import './Todo.css';
|
||||
|
||||
import {
|
||||
QUERY_TODO,
|
||||
MUTATION_TODO_ADD
|
||||
} from './graphQueries/todoQueries';
|
||||
|
||||
export default class TodoInput extends React.Component {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
textboxValue: ''
|
||||
}
|
||||
}
|
||||
|
||||
handleTextboxValueChange = (e) => {
|
||||
this.setState({
|
||||
...this.state,
|
||||
textboxValue: e.target.value
|
||||
});
|
||||
}
|
||||
|
||||
handleTextboxKeyPress = (e, addTodo) => {
|
||||
if (e.key === 'Enter') {
|
||||
const newTask = this.state.textboxValue;
|
||||
const userId = this.props.userId;
|
||||
addTodo({
|
||||
variables: {
|
||||
objects: [{
|
||||
task: newTask,
|
||||
user_id: userId,
|
||||
completed: false
|
||||
}]
|
||||
},
|
||||
update: (store, { data: { insert_todo }}) => {
|
||||
const data = store.readQuery({ query: QUERY_TODO })
|
||||
const insertedTodo = insert_todo.returning;
|
||||
data.todo.splice(0, 0, insertedTodo[0])
|
||||
store.writeQuery({
|
||||
query: QUERY_TODO,
|
||||
data
|
||||
})
|
||||
this.setState({
|
||||
...this.state,
|
||||
textboxValue: ''
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Mutation mutation={MUTATION_TODO_ADD}>
|
||||
{(addTodo, { data, loading, called, error }) => {
|
||||
return (
|
||||
<div className="parentContainer">
|
||||
<input className="input" placeholder="Add a todo" value={this.state.textboxValue} onChange={this.handleTextboxValueChange} onKeyPress={e => {
|
||||
this.handleTextboxKeyPress(e, addTodo);
|
||||
}}/>
|
||||
<br />
|
||||
</div>
|
||||
)
|
||||
}}
|
||||
</Mutation>
|
||||
)
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Query } from "react-apollo";
|
||||
import Todo from './Todo';
|
||||
import {
|
||||
QUERY_TODO,
|
||||
} from './graphQueries/todoQueries';
|
||||
|
||||
const TodoList = () => (
|
||||
<Query query={QUERY_TODO}>
|
||||
{({loading, error, data}) => {
|
||||
if (loading) {
|
||||
return (
|
||||
<div>Loading. Please wait...</div>
|
||||
);
|
||||
}
|
||||
if (error) {
|
||||
return (
|
||||
<div>{""}</div>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div className="parentContainer">
|
||||
<ul className="todoList">
|
||||
{
|
||||
data.todo.map((todo, index) => {
|
||||
return (
|
||||
<Todo key={index} todo={todo} />
|
||||
);
|
||||
})
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}}
|
||||
</Query>
|
||||
);
|
||||
|
||||
export default TodoList;
|
@ -1,47 +0,0 @@
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
const QUERY_TODO = gql`
|
||||
query fetch_todos {
|
||||
todo {
|
||||
id
|
||||
task
|
||||
completed
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const MUTATION_TODO_ADD = gql`
|
||||
mutation insert_todo ($objects: [todo_insert_input!]){
|
||||
insert_todo(objects: $objects) {
|
||||
affected_rows
|
||||
returning {
|
||||
id
|
||||
task
|
||||
completed
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const MUTATION_TODO_UPDATE = gql`
|
||||
mutation update_todo ($todoId: Int, $set: todo_set_input!) {
|
||||
update_todo(where: {id: {_eq: $todoId}} _set: $set) {
|
||||
affected_rows
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const MUTATION_TODO_DELETE = gql`
|
||||
mutation delete_todo ($todoId: Int) {
|
||||
delete_todo(where: {id: {_eq: $todoId}}) {
|
||||
affected_rows
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export {
|
||||
QUERY_TODO,
|
||||
MUTATION_TODO_ADD,
|
||||
MUTATION_TODO_UPDATE,
|
||||
MUTATION_TODO_DELETE
|
||||
};
|
@ -1,3 +0,0 @@
|
||||
export const GRAPHQL_URL = '';
|
||||
export const authClientId = "-xAjyy0cRGup4TLEodLDqszZ7wptkT6a";
|
||||
export const authDomain = "wawhal.auth0.com";
|
@ -1,3 +0,0 @@
|
||||
import createHistory from 'history/createBrowserHistory'
|
||||
|
||||
export default createHistory()
|
@ -1,5 +0,0 @@
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: sans-serif;
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
import ReactDOM from 'react-dom';
|
||||
import './index.css';
|
||||
import 'bootstrap/dist/css/bootstrap.css';
|
||||
import { makeMainRoutes } from './routes';
|
||||
|
||||
const routes = makeMainRoutes();
|
||||
ReactDOM.render(
|
||||
routes,
|
||||
document.getElementById('root')
|
||||
);
|
@ -1,74 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Route, Router } from 'react-router-dom';
|
||||
import App from './App';
|
||||
import Home from './Home/Home';
|
||||
import Callback from './Callback/Callback';
|
||||
import Auth from './Auth/Auth';
|
||||
import history from './history';
|
||||
import ApolloClient from 'apollo-client';
|
||||
import { createHttpLink } from 'apollo-link-http';
|
||||
import { setContext } from 'apollo-link-context';
|
||||
import { ApolloProvider } from 'react-apollo';
|
||||
import { InMemoryCache } from 'apollo-cache-inmemory';
|
||||
|
||||
import { GRAPHQL_URL } from './constants';
|
||||
|
||||
|
||||
const httpLink = createHttpLink({
|
||||
uri: GRAPHQL_URL,
|
||||
});
|
||||
|
||||
const authLink = setContext((_, { headers }) => {
|
||||
// get the authentication token from local storage if it exists
|
||||
const token = localStorage.getItem('auth0:access_token');
|
||||
// return the headers to the context so httpLink can read them
|
||||
return {
|
||||
headers: {
|
||||
...headers,
|
||||
authorization: token ? `Bearer ${token}` : "",
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const client = new ApolloClient({
|
||||
link: authLink.concat(httpLink),
|
||||
cache: new InMemoryCache({
|
||||
addTypename: false
|
||||
})
|
||||
});
|
||||
|
||||
const provideClient = (component) => {
|
||||
return (
|
||||
<ApolloProvider client={client}>
|
||||
{component}
|
||||
</ApolloProvider>
|
||||
);
|
||||
};
|
||||
|
||||
const auth = new Auth();
|
||||
|
||||
const handleAuthentication = ({location}) => {
|
||||
if (/access_token|id_token|error/.test(location.hash)) {
|
||||
auth.handleAuthentication();
|
||||
}
|
||||
}
|
||||
|
||||
export const makeMainRoutes = () => {
|
||||
return (
|
||||
<Router history={history}>
|
||||
<div className="container">
|
||||
<Route
|
||||
path="/"
|
||||
render={(props) => provideClient(<App auth={auth} {...props} />)}
|
||||
/>
|
||||
<Route
|
||||
path="/home"
|
||||
render={(props) => provideClient(<Home auth={auth} {...props} />)} />
|
||||
<Route path="/callback" render={(props) => {
|
||||
handleAuthentication(props);
|
||||
return <Callback {...props}/>
|
||||
}}/>
|
||||
</div>
|
||||
</Router>
|
||||
);
|
||||
}
|
@ -21,8 +21,7 @@ Once deployed, you can use any of the following endpoints as your auth webhook i
|
||||
|
||||
- ``/simple/webhook`` (`View source <https://github.com/hasura/graphql-engine/blob/master/community/boilerplates/auth-webhooks/nodejs-express/server.js>`__)
|
||||
- ``/firebase/webhook`` (`View source <https://github.com/hasura/graphql-engine/blob/master/community/boilerplates/auth-webhooks/nodejs-express/firebase/firebaseHandler.js>`__)
|
||||
- ``/auth0/webhook`` (`View source <https://github.com/hasura/graphql-engine/blob/master/community/boilerplates/auth-webhooks/nodejs-express/auth0/auth0Handler.js>`__)
|
||||
|
||||
.. note::
|
||||
|
||||
If you are using ``auth0`` or ``firebase`` you will have to set the associated environment variables.
|
||||
If you are using ``firebase`` you will have to set the associated environment variables.
|
||||
|
Loading…
Reference in New Issue
Block a user