How to change user's primary-login via API

新規投稿

コメント

5件のコメント

  • szinski

    So, is this true? To change a user's login you have to do the following steps?

     

    1. Create a new email alias

    2. Set login to new alias

    3. Delete old alias

     

    Seems like a lot of work.

    0
    コメントアクション パーマリンク
  • kendomen

    Yes.  I had to do that and also add  {is_confirmed: true} to the new email.  This is an example in node:

     

    // 1.  Add new emailAlias
    adminAPIClient.users.addEmailAlias(userId, newEmail, {is_confirmed: true}, function (err, newAlias) {
    
            // 2.  update user login with new email alias.  This makes the former login an email alias 
            adminAPIClient.users.update(userId, {login: newEmail}, function (err, updatedUser) {                    
                console.log(updatedUser);                                   
                
                // 3.  get the last emailAlias for this user which equals former login
                adminAPIClient.users.getEmailAliases(userId, function (err, emailAliases) {       
                    var emailAliasId = emailAliases.entries[emailAliases.entries.length -1].id;
                    
                    // 4.  remove the last emailAlias
                    adminAPIClient.users.removeEmailAlias(userId, emailAliasId, function (err, cleanedUpUser) {                    
                          
                    });
                });
            });    
    });

     

    0
    コメントアクション パーマリンク
  • kendomen

    We have a boxadmin app that does just that but it also transfers the content if the new email alias is an existing user.

     

    boxadmin.png

    0
    コメントアクション パーマリンク
  • cfarley

    I have been unsuccessful in trying to add an email address and assigning is_confirmed to true. Does this still work for you?  Thanks

    0
    コメントアクション パーマリンク
  • iancrew

    Hi  :

     

    Two clarifying questions:

     

    1. Is the alias you're adding in one of the domains that is associated with your Box Enterprise? If so, is_confirmed should automatically go to "true."
    2. If your Box Enterprise does not use SSO, has the user who you're adding the alias to logged into their account at least once?

    Cheers,

     

    Ian Crew

    UC Berkeley

    0
    コメントアクション パーマリンク

サインインしてコメントを残してください。