Auth0 Home Blog Docs

user metadata

user-metadata

#1

so just setup Auth0 with LinkedIn API for my ionic 2 app. Users sign in and sign up no issues. How do I get them to add extra details during the sign-up process with social logon. I have a redirect Rule setup but not sure where to go next and also how to restrict this redirect rule for sign up only and not login if user accoutn already exists. Any help useful. I am fairly new to development also.


#2

You can restrict a Redirect Rule to occur only on sign up (first login), by checking for context.stats.loginsCount:

function (user, context, callback) {

  //Not first login, don't perform redirect
  if(context.stats.loginsCount > 1){
    callback(null, user, context);
  }
 
  //First login
  if (context.protocol === "redirect-callback") {
        // User was redirected to the /continue endpoint
        // Continue to final destination URL
        return callback(null, user, context);   
  } else {
        // User is logging in directly
        context.redirect = {
          url: "http://URL_TO_REDIRECT_TO"
        };
        return callback(null, user, context);
  } 
}

The URL you redirect to should then capture any additional information you’d like.


#3