# Possible bug when activating user via Java SDK

**URL:** <https://devforum.okta.com/t/possible-bug-when-activating-user-via-java-sdk/10659>\
**Category:** Questions\
**Created:** [August 24, 2020, 7:22pm UTC](https://devforum.okta.com/t/possible-bug-when-activating-user-via-java-sdk/10659 "2020-08-24T19:22:43Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![dev.bobton](https://avatars.discourse-cdn.com/v4/letter/d/da6949/32.png) [@dev.bobton](https://devforum.okta.com/u/dev.bobton)\
**Post date:** [August 24, 2020, 7:22pm UTC](https://devforum.okta.com/t/possible-bug-when-activating-user-via-java-sdk/10659/1 "2020-08-24T19:22:43Z")

</div>

Hello!

I am using Okta in my VueJS + Java Spring Boot app and have stumbled upon a possible bug.

I am able to create an user with password, using the option .setActive(false), so that the user goes to the “Staged” state, for later activation.

After that, I send my own activation email with a link to a route on my backend that activates the user:  
1- I get the user with com.okta.sdk.client.Client.getUser(oktaUserId) -\> with a properly built client  
2- I activate the user with com.okta.sdk.resource.user.User.activate(false) -\> no need for email

The problem is:  
when the user clicks on the email link on a browser which has already logged in to the application (but **is not currently logged in** ), the user goes to “Pending user action” state.  
If the user copies the link and opens in a private window (anonymous), the user goes to “Active” state, as expected.

Any ideas on what is going on?

---

<div class="post-metadata">

**Author:** ![phi1ipp](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@phi1ipp](https://devforum.okta.com/u/phi1ipp)\
**Post date:** [August 25, 2020, 12:37am UTC](https://devforum.okta.com/t/possible-bug-when-activating-user-via-java-sdk/10659/2 "2020-08-25T00:37:55Z")

</div>

Not sure I fully understood… When a user clicks the custom link, what do you do on the backend to activate?

---

<div class="post-metadata">

**Author:** ![dev.bobton](https://avatars.discourse-cdn.com/v4/letter/d/da6949/32.png) [@dev.bobton](https://devforum.okta.com/u/dev.bobton)\
**Post date:** [August 25, 2020, 1:14am UTC](https://devforum.okta.com/t/possible-bug-when-activating-user-via-java-sdk/10659/3 "2020-08-25T01:14:43Z")

</div>

I want to change the user status from STAGED to ACTIVE.  
It works when the user access the custom link from a private window in  
chrome/firefox (maybe something to do with cookies?).  
If the user access my custom link from a browser which he has already  
logged in to the okta application, the state becomes PENDING USER ACTION  
(instead of ACTIVE), even though the okta log shows the user is active.

The user is created with password and user.setActive(false) so it  
becomes STAGED.

 ![log.PNG](https://global.discourse-cdn.com/oktadev/original/2X/0/036a7593efe8b0a40bd84fb85a60ad798c1f3210.png)

 ![state.PNG](https://global.discourse-cdn.com/oktadev/original/2X/5/5e0369e149dae1429b975a4cbd939f9d865b37f2.png)

---

<div class="post-metadata">

**Author:** ![phi1ipp](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@phi1ipp](https://devforum.okta.com/u/phi1ipp)\
**Post date:** [August 25, 2020, 1:40am UTC](https://devforum.okta.com/t/possible-bug-when-activating-user-via-java-sdk/10659/4 "2020-08-25T01:40:58Z")

</div>

When you say “custom link” what exactly do you mean? Is it a custom domain name for the okta tenant? Or is it the URL for your server which performs activation? In the latter case, can you capture an api call to Okta with tcpdump or similar stuff.

---

<div class="post-metadata">

**Author:** ![dev.bobton](https://avatars.discourse-cdn.com/v4/letter/d/da6949/32.png) [@dev.bobton](https://devforum.okta.com/u/dev.bobton)\
**Post date:** [August 25, 2020, 1:58am UTC](https://devforum.okta.com/t/possible-bug-when-activating-user-via-java-sdk/10659/5 "2020-08-25T01:58:33Z")

</div>

It is a route in my Spring Boot controller that calls the Okta Client  
from the Java SDK:

 ![sdk.PNG](https://global.discourse-cdn.com/oktadev/original/2X/3/3bb0e2e73106a88bd0c7fe61fd60057ffa336294.png)

---

<div class="post-metadata">

**Author:** ![phi1ipp](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@phi1ipp](https://devforum.okta.com/u/phi1ipp)\
**Post date:** [August 25, 2020, 2:31am UTC](https://devforum.okta.com/t/possible-bug-when-activating-user-via-java-sdk/10659/6 "2020-08-25T02:31:37Z")

</div>

Did you check, what happens if you are not sending an activation email? [https://developer.okta.com/docs/reference/api/users/#activate-user](https://developer.okta.com/docs/reference/api/users/#activate-user)

---

<div class="post-metadata">

**Author:** ![dev.bobton](https://avatars.discourse-cdn.com/v4/letter/d/da6949/32.png) [@dev.bobton](https://devforum.okta.com/u/dev.bobton)\
**Post date:** [August 25, 2020, 12:11pm UTC](https://devforum.okta.com/t/possible-bug-when-activating-user-via-java-sdk/10659/7 "2020-08-25T12:11:49Z")

</div>

Yes, I am not sending the activation email.  
The password is set before the user is activated, so it should be  
possible to login with the password when activated, as described in the  
link you provided (see image attached).  
The whole process works fine when the user uses a private window or has  
never logged in to the application in the same browser.  
It fails when it uses a browser which has previously logged in to the  
application. (but is the same process in the back/front-end)

 ![info.PNG](https://global.discourse-cdn.com/oktadev/original/2X/f/f2037390a7d30ecaaa74103859c501d4d2d908cd.png)

---

<div class="post-metadata">

**Author:** ![phi1ipp](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@phi1ipp](https://devforum.okta.com/u/phi1ipp)\
**Post date:** [August 25, 2020, 12:47pm UTC](https://devforum.okta.com/t/possible-bug-when-activating-user-via-java-sdk/10659/8 "2020-08-25T12:47:42Z")

</div>

Oh OK, I was just referring you to the doc for the status of a user, after you activate them. Let me ask you other thing then. Is user able to log into Okta after you activate them directly, rather than to your app?

---

<div class="post-metadata">

**Author:** ![dev.bobton](https://avatars.discourse-cdn.com/v4/letter/d/da6949/32.png) [@dev.bobton](https://devforum.okta.com/u/dev.bobton)\
**Post date:** [August 25, 2020, 1:01pm UTC](https://devforum.okta.com/t/possible-bug-when-activating-user-via-java-sdk/10659/9 "2020-08-25T13:01:14Z")

</div>

If the user is in a private window, resulting in a ACTIVE state, he is able to login with his password.  
If the user is in a browser which has previously logged in, resulting in a PENDING USER ACTION state, I am able to reset his password and activate manually, and then he has to change the password. After that he is able to login.

---

<div class="post-metadata">

**Author:** ![dev.bobton](https://avatars.discourse-cdn.com/v4/letter/d/da6949/32.png) [@dev.bobton](https://devforum.okta.com/u/dev.bobton)\
**Post date:** [August 25, 2020, 1:47pm UTC](https://devforum.okta.com/t/possible-bug-when-activating-user-via-java-sdk/10659/10 "2020-08-25T13:47:57Z")

</div>

phi1ipp, sorry for wasting your time.  
The problem was on my side. Sometimes the password was not properly set.

Everything is working as it is supposed to.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [January 24, 2024, 11:59pm UTC](https://devforum.okta.com/t/possible-bug-when-activating-user-via-java-sdk/10659/11 "2024-01-24T23:59:35Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
