demellor

Move Pending users to Active

0 votes

We use SSO so we don't sending out the invitation for users to activate their accounts.  How can I programmatically activate the accounts using the .NET SDK.  I can determine who's pending from the list of senders, but not sure how to update their status to ACTIVE.  

 

We have used the invitation utility but want to automate the process.

Richard DeMello


Reply to: Move Pending users to Active

0 votes

Hi Richard,

 

I doubt the .NET SDK has the ability to update sender status to ACTIVE, you can use below RESTful method instead:

        public void ActivateSender(string senderId, string apiUrl, string apiKey)
        {
            HttpClient myClient = new HttpClient();
            myClient.DefaultRequestHeaders.Add("Authorization", "Basic " + apiKey);
            myClient.DefaultRequestHeaders.Add("Accept", "application/json");
            StringContent jsonContent = new StringContent("{\"status\":\"ACTIVE\"}", Encoding.UTF8, "application/json");

            var response = myClient.PostAsync(new Uri(apiUrl + $"/account/senders/{senderId}"), jsonContent).Result;

            if (!response.IsSuccessStatusCode)
            {
                throw new Exception(response.Content.ReadAsStringAsync().Result);
            }
        }



        ActivateSender("mChXnDrrh8A5", apiUrl, apiKey);

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off