Skip to content

Instantly share code, notes, and snippets.

View alexisabril's full-sized avatar
🤙

Alexis Abril alexisabril

🤙
View GitHub Profile
### Keybase proof
I hereby claim:
* I am alexisabril on github.
* I am alexisabril (https://keybase.io/alexisabril) on keybase.
* I have a public key ASATOxoB1AhmacsFFixNievsoEsDZniIQhVFi2qcDXG0dwo
To claim this, I am signing this object:
@alexisabril
alexisabril / index.js
Created May 16, 2018 15:34
05-16-18-heroprotocol-node
const heroprotocol = require('heroprotocol');
heroprotocol.gameevents('path/to/replay.StormReplay').then(output => {
//output is a JSON object!
});
@alexisabril
alexisabril / hooks.js
Created May 10, 2018 19:40
05-07-18-feathersjs-and-google-oauth2/src/services/items/hooks.js
const { authenticate } = require('@feathersjs/authentication').hooks;
/*
By placing the `authenticate` hook in `before.all`, any request received by this application
must first pass through this hook. The `authenticate` hook accepts an array of named strategies.
This application is built on the premise that a valid JWT will be created after successful OAuth
verification. As a result, the JWT strategy is the only required input.
*/
module.exports = {
before: {
@alexisabril
alexisabril / package.json
Created May 10, 2018 19:38
05-07-18-feathersjs-and-google-oauth2/package.json
"dependencies": {
"@feathersjs/authentication": "^2.1.5",
"@feathersjs/authentication-jwt": "^2.0.0",
"@feathersjs/authentication-oauth2": "^1.0.3",
"@feathersjs/configuration": "^1.0.2",
"@feathersjs/express": "^1.2.2",
"@feathersjs/feathers": "^3.1.4",
"body-parser": "^1.18.2",
"feathers-memory": "^2.1.1",
"passport-google-oauth2": "^0.1.6"
@alexisabril
alexisabril / index.js
Created May 10, 2018 19:30
05-07-18-feathersjs-and-google-oauth2/src/services/authentication/index.js
/*
The authentication module sets up the `/authentication` endpoint, while the JWT module handles
the creation and verification of JWTs. The OAuth2 and Passport modules handle where OAuth requests
should be sent and how they are received. Passport handles the OAuth flow and upon completion invokes
the respective Feathers service call(s).
*/
const authentication = require('@feathersjs/authentication');
const jwt = require('@feathersjs/authentication-jwt');
const oauth2 = require('@feathersjs/authentication-oauth2');
const { Strategy } = require('passport-google-oauth2');
@alexisabril
alexisabril / default.json
Last active May 10, 2018 19:28
05-07-18-feathersjs-and-google-oauth2/config/default.json-b
{
"port": 9001,
"authentication": {
"secret": "...",
"google": {
"clientID": "...apps.googleusercontent.com",
"clientSecret": "..."
}
}
}
@alexisabril
alexisabril / default.json
Created May 10, 2018 19:24
05-07-18-feathersjs-and-google-oauth2/config/default.json
{
"port": 9001,
"authentication": {
"google": {
"clientID": "...apps.googleusercontent.com",
"clientSecret": "..."
}
}
}
@alexisabril
alexisabril / index.md
Last active May 10, 2018 19:16
05-07-18-feathersjs-and-google-oauth2/directory-structure
  • /project-root
    • /config
    • /src
      • /services
        • /authentication
        • /items
        • /users
        • index.js
      • index.js
  • package.json
@alexisabril
alexisabril / sample.js
Last active March 8, 2018 18:53
Failing `getByDot` example
const feathers = require('@feathersjs/feathers');
const memory = require('feathers-memory');
const hooks = require('feathers-hooks-common');
const app = feathers();
app.use('/items', memory());
app.service('items').hooks({