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

authenticate with a custom username field (rather than email) #502

Closed
ramsestom opened this Issue May 9, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@ramsestom
Copy link

ramsestom commented May 9, 2017

I tried to use the field username of my users table for the authentication instead of email. So I changed "usernameField": "email", to "usernameField": "username", in default.json

But when I try to create a new user with username/password, I have this error returned by the server:

info: error: authentication - Method: create: Missing credentials
error:  Error
    at Object.<anonymous> (C:\Development\feathers\grapevine-server\node_modules\feathers-errors\lib\index.js:64:27)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Development\feathers\grapevine-server\node_modules\feathers-rest\lib\wrappers.js:13:23)
    at Module._compile (module.js:571:32)

any idea of what might be the problem?

@snewell92

This comment has been minimized.

Copy link

snewell92 commented May 11, 2017

In your users.hooks.js does it add the authentication(...) hook on create?

@ramsestom

This comment has been minimized.

Copy link
Author

ramsestom commented May 11, 2017

The problem was actually that I had an env variable called "USERNAME" on windows and it messed up with feathers.js on runtime. Problem solved by escaping the "username" value with "\" in my default.json file (so "usernameField": "\\username").

@ramsestom ramsestom closed this May 11, 2017

@realdubb

This comment has been minimized.

Copy link

realdubb commented Nov 20, 2017

Thanks @ramsestom your solution worked for me!

@NicoEnking

This comment has been minimized.

Copy link

NicoEnking commented Jan 12, 2018

Thanks alot @ramsestom ! That really saved me some time.

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.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.