Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

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

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

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

ramsestom opened this issue May 9, 2017 · 4 comments

Comments

@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
Copy link

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

@ramsestom
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").

@realdubb
Copy link

Thanks @ramsestom your solution worked for me!

@enyineer
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants