Comments (2)
Hey, I was also having this issue, but I found a way to get around it. The issue is with the value corresponding to "role" in the "user" object contained in the payload. This needs to be a role's "_id", not a role's "name". However, joi validates "role" by comparing it to role "name"s stored in the object constants["USER_ROLES"], which lies in /config.js. You will need to edit /config.js so that joi can compare "role" to role "_id"s instead of role "name"s which then allows the payload to pass role "_id"s.
Specifically, use the GET /roles endpoint to get a list of roles. Replace the values in constants["USER_ROLES"], found in /config.js, with the corresponding role "_id"s. Then whenever you give the payload, pass the role "_id" that corresponds to the role you wish to use.
from appy-backend.
Thanks for pointing this out! Also thank you @pkmgarcia for pointing out the workaround. Somehow this endpoint fell through the cracks during recent development. @vsiguero, if you pull the most recent code for the registration endpoint your payload should work. Although @pkmgarcia's work around is a viable option, I would suggest sticking with passing the role's "name" to the endpoint, simply because the use case of this endpoint assumes the user does not have an account, and therefore can not authenticate. In a working application the user would have to authenticate in order to pass a "GET" to the /roles endpoint, which would make it difficult to access the corresponding role "_Id".
from appy-backend.
Related Issues (20)
- Gulp seed not working on first go. Windows 10 HOT 2
- Do we need PasswordHash in Refresh Token? HOT 1
- support multiple sessions HOT 11
- Unable to run HOT 2
- /login/forgot issue HOT 1
- Adding a new model object HOT 2
- Adding authorizeDocumentCreator HOT 7
- mysql HOT 1
- POST /login/forgot - "statusCode": 504, "error": "Gateway Timeout", "message": "An error occurred." HOT 4
- hoek dependency interrupts gulp HOT 3
- Is there a deployment guide? HOT 1
- Adding a front end HOT 2
- update to latest rest-hapi
- Issue with Pagination
- Issue when registering subsequent accounts
- implement dynamic scopes allowing access to specific documents HOT 2
- Debugging HOT 2
- createdBy field HOT 5
- TypeError: require.extensions.hasOwnProperty is not a function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from appy-backend.