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

POST to /auth/local never gets response #88

Closed
mastertinner opened this Issue Feb 29, 2016 · 10 comments

Comments

Projects
None yet
3 participants
@mastertinner
Copy link
Contributor

mastertinner commented Feb 29, 2016

When I try to POST my credentials to /auth/local, the request never gets a response when I'm trying with correct credentials. When I try with incorrect credentials however, the response to the request is NotAuthenticated: Invalid login..

My setup is the following:

'use strict';

const feathers = require('feathers');
const rest = require('feathers-rest');
const socketio = require('feathers-socketio');
const MongooseService = require('feathers-mongoose');
const hooks = require('feathers-hooks');
const authentication = require('feathers-authentication');
const authHooks = require('feathers-authentication').hooks;
const sync = require('feathers-sync');
const bodyParser = require('body-parser');
const cors = require('cors');
const logger = require('morgan');

// datasources
const redisUrl = require('./datasources/redis');

// models
const UserModel = require('./models/user');

// hooks
const requireAdmin = require('./hooks/require-admin');
const requireProviderFor = require('./hooks/require-provider-for');

// services
const CheckmarxService = require('./services/checkmarx');
const HealthstatusService = require('./services/health-status');
const PuppetService = require('./services/puppet');

const apiBase = '/api';

const app = feathers();

app.configure(rest());
app.configure(socketio());
app.configure(hooks());
app.configure(sync({ db: redisUrl }));

app.use(cors());
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));

app.configure(authentication({
  local: {
    usernameField: 'username',
    userEndpoint: `${apiBase}/users`
  }
}));

app.use(`${apiBase}/checkmarx`, new CheckmarxService());
app.use(`${apiBase}/healthstatus`, new HealthstatusService());
app.use(`${apiBase}/puppet`, new PuppetService());
app.use(`${apiBase}/users`, new MongooseService({ Model: UserModel }));

const checkmarxService = app.service(`${apiBase}/checkmarx`);
const healthService = app.service(`${apiBase}/healthstatus`);
const puppetService = app.service(`${apiBase}/puppet`);
const userService = app.service(`${apiBase}/users`);

module.exports = app;

@mastertinner mastertinner changed the title /auth/local get stuck POST to /auth/local gets no response Feb 29, 2016

@mastertinner mastertinner changed the title POST to /auth/local gets no response POST to /auth/local never gets response Feb 29, 2016

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Feb 29, 2016

@mastertinner what version of feathers-authentication are you using? Make sure you are on the latest of all the modules. We pushed a bunch of bug fixes the last week or so.

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Mar 1, 2016

@mastertinner let me know if updating to the latest doesn't work and we can try and figure out what is going on.

@mastertinner

This comment has been minimized.

Copy link
Contributor Author

mastertinner commented Mar 1, 2016

Thanks for the quick reply, @ekryski. I'm using
feathers: 2.0.0
feathers-authentication: 0.4.1
feathers-hooks: 1.3.0

I believe, this are the latest versions.

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Mar 1, 2016

@mastertinner those are all the latest yup. I see that you are not including a secret:

{
  token: {
    secret: 'my secret'
  }
}

This shouldn't be a problem because we automatically generate one on this line but maybe their is a bug with the configuration. I'll be adding tests today and I'll make sure that we have a working example to reference.

We do have a working demo app here

@mastertinner

This comment has been minimized.

Copy link
Contributor Author

mastertinner commented Mar 1, 2016

Thanks for investigating, guys! Unfortunately, setting a secret didn't solve the problem. I will keep on investigating on my side and keep you posted.

@rafalszemraj

This comment has been minimized.

Copy link

rafalszemraj commented Mar 6, 2016

Hi @mastertinner, did you find anything? I have same problem on my side (using latest feathers-*)...

@rafalszemraj

This comment has been minimized.

Copy link

rafalszemraj commented Mar 6, 2016

Actually, I found the issue. In config for auth local.userEnpoint should be defined in root level. Otherwise it will be overwritten in here

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Mar 6, 2016

Hmm. That's not how it should work. I'm going to add some more tests today and maybe a few more error/warning messages to make sure things are set up as expected. Thanks for digging into that @rafalszemraj.

@mastertinner

This comment has been minimized.

Copy link
Contributor Author

mastertinner commented Mar 7, 2016

Thanks a lot for your investigation, guys! In that case we should probably change the examples because some of them contain userEndpoint in the local part of the config. (E.g. https://github.com/feathersjs/feathers-authentication/blob/master/examples/basic/index.js is where I got the idea). Is that in your interest, @ekryski?

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Mar 7, 2016

@mastertinner yup. My bad. I'm probably going to move some of the more advanced examples over to feathers-demos.

@mastertinner mastertinner referenced this issue Mar 9, 2016

Merged

Fix examples #98

@ekryski ekryski closed this in #98 Mar 9, 2016

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.