GithubHelp home page GithubHelp logo

koa2-rest-api's Introduction

Starter project for an ES6 RESTFul Koa2 API with Mongoose and OAuth2

currently in development...

OAuth2 Provider

You need to create a provider.js file in server/auth and add your oAuth2 provider credentials, like:

'use strict';

export const facebook = {
  clientId: YOUR_CLIENT_ID,
  clientSecret: YOUR_CLIENT_SECRET,
  route: '/auth/facebook',
  callbackRoute: '/auth/facebook/callback',
};

koa2-rest-api's People

Contributors

cht8687 avatar rusty1s avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

koa2-rest-api's Issues

Facebook Graph Request

Great repo!

How are you going to do facebook graph request after getting user accesstoken ?

Why not jwt?

I trying to make a rest api similar to yours...
Shouldn't be better to use JWT instead of bearer and not saving into database?

Why do you put the profile in the strategy instead of callbackURL as is in the docs?

passport.use(new FacebookStrategy({
    clientID: FACEBOOK_APP_ID,
    clientSecret: FACEBOOK_APP_SECRET,
    callbackURL: "http://localhost:3000/auth/facebook/callback"
  },
  function(accessToken, refreshToken, profile, cb) {
    User.findOrCreate({ facebookId: profile.id }, function (err, user) {
      return cb(err, user);
    });
  }
));
` ``

npm test error

I'm receiving this error when I try to run npm test

> koa2-rest-api@0.0.0 test koa2-rest-api
> mocha test

path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.dirname (path.js:1324:5)
    at koa2-rest-api/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:374:36
    at koa2-rest-api/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:396:22
    at Array.map (native)
    at OptionManager.resolvePresets (koa2-rest-api/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:385:20)
    at OptionManager.mergePresets (koa2-rest-api/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:369:10)
    at OptionManager.mergeOptions (koa2-rest-api/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:328:14)
npm ERR! Test failed.  See above for more details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.