score:1
Accepted answer
after skimming through the provided frontend tutorial, i think i can narrow the problem down to the component authservice. it has a method named register:
register(username, email, password) {
return axios.post(api_url + "signup", {
username,
email,
password
});
}
because currently you never send a role when the user registers. so new users always end up with the default role. if you would want to give the user another role than the default one at registration, you would have to add the parameter roles to the config object in the axios.post function. for example like this:
register(username, email, password) {
return axios.post(api_url + "signup", {
username,
email,
password,
roles=[ "role_admin" ]
});
}
so you could create another signup page where you use this modified register function instead of the default one.
Source: stackoverflow.com
Related Query
- Using roles and specific user id to limit what sections can be viewed in react / node / express / mysql?
- How to handle React Router with Node Express routing
- Best practice for React Router user roles (Firebase)
- React Application and User Roles
- React Fetch() my local Node Express backend; Cannot return get request String value
- Unhandled rejection TypeError: dbUser.validPassword is not a function Sequelize Node React Passport
- Can I use mock data and proxy api data at the same time in my react project when using node express as a proxy server?
- How to handle authentication from a Node Express redirect to React Client (react-router-dom and useContext)
- Passing OAuth user data back to React via Node (Passport) authentication
- Pass Data from React to node express server
- Passing the user session from express to React state
- Email api using react node nodemailer express is not working
- Deploy Node Express app to Heroku that serves React app
- Configure ports in WebStorm - React + Node Express app
- Show public logic if user is not authenticated React JS and Node API
- express http: 500 error on graphql mutation to create user from apollo client in react
- I am using socketio with react as the frontend and node with express js to make an app
- How to persist user login in a React & Redux, express backend app with JWT and without packages like redux-persist?
- React Fetch() my local Node Express backend; Cannot return the backend test value
- Unhandled Rejection (TypeError): Failed to fetch (POST) react / node / express
- Fetching param.id data from front to backend - React / Node / Express
- Different React Webpack JS Bundles for User Roles
- React express jwt, Where to call the api to check if a user if logged in
- User roles: node.js express sequelize react.js
- How to call an external URL from a react express node component?
- error redirect to react after local auth with passport using node js express
- User Login and Roles in React or Node?
- How to structure the component folders based on different user roles in react
- Node application interactively get user input from react front end by pausing the current execution
- REACT - Express : fetching data doesn't work on reload when user connected
More Query from same tag
- Using withState and lifecycle from recompose together
- Gatsby: Index page "/" fails to load when using MDX, other path loads
- How can I modify the default css / style of the auth buttons that firebase provides me?
- handling fast move of mouse on mousemove while resizinng an element
- Need to Trigger individual Element in an array of elements written through map function reactjs
- React/Redux + super agent, first call gets terminated
- Show character limit under input in React Js
- Why is my component not rendering a prop value?
- Calling and passing API data to other component in React.js
- Access ref from class component in functional component with React
- How to make Ant design's Form List required?
- Access React DOM Element from external script
- Printing Array of Objects from API call in React.js
- React app deployment error Error during NPM install
- How to share a specific variable between different react components
- Why is jest unit test broken?
- Too many re-renders in react when using useReducer Hook
- Extracting styles from material ui component
- How to set component default props on React component
- Component not re-rendering after onChange event
- how to convert to application/pdf response to file in axios?
- ReactJS + NodeJS server + Filepond uploading file
- How to share redux state client-side and props server-side in Next JS
- Reactjs Material-UI - Unexpected token on arrow functions
- Extending a html component get attributes are not working
- Get Inputs From Child Component Form That Doesn't Pass Props?
- Cookies are stored with fetch but not with axios
- Changing state of a different component - ReactJS
- Trying to map through returned data after a form submit. NextJS
- Error routing user to another component after login