Code Monkey home page Code Monkey logo

koa-oauth-server's People

Contributors

fixe avatar nunofgs avatar ruimarinho avatar thomseddon 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  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  avatar

koa-oauth-server's Issues

TypeError: Cannot read property 'set' of undefined

Version 2.4.0 of node-oauth2-server seems to have introduced a breaking change. I'll provide more information as soon as I can.

 TypeError: Cannot read property 'set' of undefined
      at Grant.sendResponse (/Users/johnwehr/Projects/test-project/node_modules/koa-oauth-server/node_modules/oauth2-server/lib/grant.js:471:5)
      at run (/Users/johnwehr/Projects/test-project/node_modules/koa-oauth-server/node_modules/oauth2-server/lib/runner.js:15:14)
      at /Users/johnwehr/Projects/test-project/node_modules/koa-oauth-server/node_modules/oauth2-server/lib/runner.js:17:7
      at Grant.saveRefreshToken (/Users/johnwehr/Projects/test-project/node_modules/koa-oauth-server/node_modules/oauth2-server/lib/grant.js:430:29)
      at run (/Users/johnwehr/Projects/test-project/node_modules/koa-oauth-server/node_modules/oauth2-server/lib/runner.js:15:14)
      at /Users/johnwehr/Projects/test-project/node_modules/koa-oauth-server/node_modules/oauth2-server/lib/runner.js:17:7
      at Grant.generateRefreshToken (/Users/johnwehr/Projects/test-project/node_modules/koa-oauth-server/node_modules/oauth2-server/lib/grant.js:412:66)
      at run (/Users/johnwehr/Projects/test-project/node_modules/koa-oauth-server/node_modules/oauth2-server/lib/runner.js:15:14)
      at /Users/johnwehr/Projects/test-project/node_modules/koa-oauth-server/node_modules/oauth2-server/lib/runner.js:17:7
      at /Users/johnwehr/Projects/test-project/node_modules/koa-oauth-server/node_modules/oauth2-server/lib/grant.js:401:5
      at /Users/johnwehr/Projects/test-project/models/oauth2-model.js:62:7

The offending function:

/**
 * Create an access token and save it with the model
 *
 * @param  {Function} done
 * @this   OAuth
 */
function sendResponse (done) {
  var response = {
    token_type: 'bearer',
    access_token: this.accessToken
  };

  if (this.config.accessTokenLifetime !== null) {
    response.expires_in = this.config.accessTokenLifetime;
  }

  if (this.refreshToken) response.refresh_token = this.refreshToken;

  this.res
    .set('Cache-Control', 'no-store') // Line 471
    .set('Pragma', 'no-cache')
    .jsonp(response);

  if (this.config.continueAfterResponse)
    done();
}

See the commit: thomseddon/node-oauth2-server@c19719e

Session in jquery

I try set and get session in jquery . i try this

for(var i=0;i<m.length;i++)
                    {
                        if (m[i] !== null)
                        {
                            master.row.add({
                                " Type": m[i][1],
                                "Frequency": m[i][2],


                            })

                        }                       

                    }
                    $.session.set("Type ", m[i][1]);
                    $.session.set("Frequency ", m[i][2]);

i also add session.js but this show error on console

Uncaught TypeError: Cannot read property 'set' of undefined(โ€ฆ)

headerToken

var headerToken = this.req.get('Authorization'),
getToken = this.req.query.access_token,
postToken = this.req.body ? this.req.body.access_token : undefined;

console.log('getToken:',getToken);
console.log('headerToken:',headerToken);
console.log('postToken:',postToken);

getToken: undefined
headerToken:
postToken: b80ba6196e247b0fae2d9226d2c722a5d01ae90b
methodsUsed: 2

question:why headerToken != undefined

KoaOAuthServer.prototype.authenticate lack of response

KoaOAuthServer.prototype.authenticate = function() {
var server = this.server;

return function *(next) {
var request = new Request(this.request);
var response = new Response(this.response);

try {
  this.state.oauth = {
    token: yield server.authenticate(request,response)
  };
} catch (e) {
  return handleError.call(this, e);
}

yield* next;

};
};

Grant and authorise hang if body parser already defined.

Hi,
i noticed that the request hangs if the app have a previously defined body parser.

app.use( betterBody );
app.post( '/oauth/token', oauth.grant() ); // hangs here

but switching the position make my app work:

app.post( '/oauth/token', oauth.grant() );
app.use( betterBody );

Is this project still active?

With the release of Koa 2 this project needs to be refactored to be promise based.

I currently have a PR open for these changes: #47

Can we get an update on the state of this project?

why seegno-forks?

I noticed that this repo deps on a fork version of node-oauth2-server. And some of its unitTest failed.

Unable to get user once authorized

So I have the following in my model:

  getAccessToken: function(bearerToken, cb) {
    cb(null, {
      expires: expires
      userId: 1
    });
  }

and then:

app.get('/secret', app.oauth.authorise(), function *(next) {
  console.log(this.req.user);
  this.body = 'secret';
});

but this.req.user is undefined... am I doing this incorrectly?

Thanks!

Model not working with generators

using version: 1.0.1

Following the examples exactly, even resorted to just copy/pasting. Doesn't seem to work at all when using generators for the model. Switched to functions, that take a callback and everything is fine.

Still alive ?

Hello,

Project looks great but I see that the version here in github is not published on npm, last one is 1.01 which is not working: oauth2-server included does not like generators.

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.