Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

361
Vistas
Pass parameters into Auth0 sign up

I am using Auth0's provided login and sign-up screen (https://auth0.com/docs/quickstart/webapp/nextjs/01-login#add-login-to-your-application) for my application. I set up a callback after signup where I create a profile in my DB with the email as the primary key.

The issue I'm running into is that on my home screen, I have a button that says "Sign up as admin" and another "Sign up as a user". How do I pass into this Auth0 sign up screen whether the user click "user" or "admin" so that in the callback I can create the profile with "user" or "admin"?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can add a state param to the /authorize request to maintain state between request and callback.

In Auth0, you if you need to discriminate between "user" or "admin", you could extract the state param specified the /authorize request from the context object (context.request to be specific) - see here for context object properties in Auth0 rules.

about 4 years ago · Juan Pablo Isaza Denunciar

0

You do not determine signup as admin or user on the front end, this is done in backend. In auth0 authentication you add rules in auth) dashboard. When you sign in auth0, you can either select a rule template or you can create your own:

enter image description here

an example of script:

function (user, context, callback) {
  user.app_metadata = user.app_metadata || {};
  // You can add a Role based on what you want
  // In this case I check email
  //***** DETERMINE ADMINS HERE *******
  var addRolesToUser = function(user, cb) {
    if (user.email === "Email@email.com") {
      cb(null, ['admin']);
    } else {
      cb(null, ['guest']);
    }
  };

  addRolesToUser(user, function(err, roles) {
    if (err) {
      callback(err);
    } else {
      user.app_metadata.roles = roles;
      auth0.users.updateAppMetadata(user.user_id, user.app_metadata)
        .then(function(){
          context.idToken[NAMESPACE] = user.app_metadata.roles;
          context.accessToken[NAMESPACE] = user.app_metadata.roles;
          callback(null, user, context);
        })
        .catch(function(err){
          callback(err);
        });
    }
  });
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda