Skip to content

Commit

Permalink
use tokenerror for client auth
Browse files Browse the repository at this point in the history
  • Loading branch information
camshaft committed Jan 13, 2014
1 parent 0b467c1 commit fd5c80f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/auth/client.js
Expand Up @@ -6,7 +6,7 @@ var debug = require('simple-debug')('consulate:auth:client');
var BasicStrategy = require('passport-http').BasicStrategy;
var ClientPasswordStrategy = require('passport-oauth2-client-password').Strategy;
var PublicClientStrategy = require('passport-oauth2-public-client').Strategy;
var AuthorizationError = require('oauth2orize/lib/errors/authorizationerror');
var TokenError = require('oauth2orize/lib/errors/tokenerror');

/**
* BasicStrategy & ClientPasswordStrategy
Expand Down Expand Up @@ -68,7 +68,7 @@ function verifyApp(passport) {
if (user) return req.logIn(user, next);

// Only allow public clients on specific exchanges
if (!~options.public_exchanges.indexOf(req.body['grant_type'])) return next(new AuthorizationError('Unauthorized client', 'invalid_client'));
if (!~options.public_exchanges.indexOf(req.body['grant_type'])) return next(new TokenError('Unauthorized client', 'invalid_client'));

return passport.authenticate('oauth2-public-client', {
session: false
Expand Down

0 comments on commit fd5c80f

Please sign in to comment.