Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot authenticate #14

dbkaplun opened this Issue Dec 1, 2015 · 2 comments


None yet
2 participants
Copy link

dbkaplun commented Dec 1, 2015

Running with DEBUG=feathers-authentication, I can see "feathers-authentication setting up feathers-authentication +0ms" in the CLI output, but I don't see "Got an Authorization token" anywhere (src/index.js:93). Also the params object only has an empty query object, no user property.


GET /api/streams/1 HTTP/1.1
Host: localhost:4000
authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwiZW1haWwiOiJhZG1pbkBleGFtcGxlLmNvbSIsImFkbWluIjowLCJjcmVhdGVkX2F0IjpudWxsLCJ1cGRhdGVkX2F0IjpudWxsLCJpYXQiOjE0NDg5MzM1NzcsImV4cCI6MTQ0ODk2OTU3N30.RpC2hOsg5seNJxbvosY6pBf1WC1zC9IC_An_I0ZCsTI
Cache-Control: no-cache
Postman-Token: 31135068-0a30-96bf-02df-5f4b750479ef

This comment has been minimized.

Copy link

marshallswain commented Dec 1, 2015

With those headers, you should be seeing the message from line 93, unless your services are being used before your auth plugin. Here is a server I have working. Maybe you can compare your server setup and figure out the cause:

var feathers = require('feathers');
var hooks = require('feathers-hooks');
var cors = require('cors');
var bodyParser = require('body-parser');
var mongoose = require('mongoose');
var MongooseService = require('feathers-mongoose');
var feathersAuth = require('feathers-authentication').default;
var dbURI = require('./db');
var app = feathers();

  .options('*', cors())
  .use(bodyParser.urlencoded({ extended: true }))
    secret: 'igotasecretivebeenhidingundermyskin',
    loginEndpoint: '/login',
    userEndpoint: '/users',
    usernameField: 'email'
  .use(feathers.static(__dirname + '/public'));

var options = {connection: mongoose.connections[0]};

var db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function () {
  console.log('Mongoose connected to ' + dbURI);

app.use('accounts', new MongooseService('Account', require('./services/accounts'), options));
app.use('preferences', new MongooseService('Preference', require('./services/preferences'), options));
app.use('users', new MongooseService('User', require('./services/users'), options));


var port = process.env.VCAP_APP_PORT || 8080;
app.listen(port, function(){
  console.log('application server listening on port ' + port);

This comment has been minimized.

Copy link

dbkaplun commented Dec 1, 2015

You're absolutely right, I was instantiating the service before .configure(feathersAuth()). Nice catch!

@dbkaplun dbkaplun closed this Dec 1, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.