Top

Unable to create user with C# administration object

Comments

5 comments

  • Christophe IRLES

    Hi,

    In your example, you have created a user without specifying its companyId. (the argument after lastName)
    It's better to specify it. Without it, it really depends of the right of the user you use.

    If you still have a pb, please provide me the exact error you have.

    Note: I suggest you to use something like that to log error:

    Util.SerializeSdkError(callback.Result)

    Regards,
    Christophe

     

    0
    Comment actions Permalink
  • William Godfrey

    Hi Christope,

    I modified the code to now include a nickname and the company id as seen below:

    admin.CreateUser(userEmailAddress, userPassword, firstName, lastName, firstName, company_id, true, createAdmin, callback

    The error I received was:

    ErrorCode:[401] - ErrorMsg:[Unauthorized] - ErrorDetails:[Format is Authorization: Bearer [token]] - ErrorDetailsCode:[401201]
    0
    Comment actions Permalink
  • William Godfrey

    Never Mind I managed to fix it by placing the following code between the login and the admin call.

    while (_rainbowApp.ConnectionState() != Rainbow.Model.ConnectionState.Connected || !_rainbowApp.IsInitialized())
    {
    if (_rainbowApp.ConnectionState() == Rainbow.Model.ConnectionState.Disconnected)
    {
    break;
    }
    }
    0
    Comment actions Permalink
  • Christophe IRLES

    Hi William,

    Take into account that all API using a callback are asynchronous. So you need to have an answer (i.e. checking result of "callback.Result.Success") before to continue.

    Login process is even more complex because the callback of this API provide you the information of correct or incorrect login/pwd. If they are correct you need also to wait event "InitializationPerformed" because it's necessary to gather several information for server before to be fully operational.

    Regards,
    Christophe

     

    0
    Comment actions Permalink
  • Christophe IRLES

    Also notice that question about SDK usage should be done in the "Hub Support Community".

    0
    Comment actions Permalink

Please sign in to leave a comment.

Still can't find what you need?

  • Contact Us

    Do you have any question about Rainbow? Leave us a message to get more information.

    Contact
  • Ask the Community

    Do you need help? Ask your questions to the Community and get answers from other Rainbow users.

    Post message