Immediate access to login after user creation Skip to main content
https://support.okta.com/help/answers?id=9062a000000xah9qak&refurl=http%3a%2f%2fsupport.okta.com%2fhelp%2fanswers
How satisfied are you with the Okta Help Center?
Thank you for your feedback!
How satisfied are you with the Okta Help Center?
1
2
3
4
5
Very Dissatisfied
Very satisfied
Enter content less than 200 characters.
Ask Search:
Morten LilengMorten Lileng 

Immediate access to login after user creation

Hello, I am attempting to add a new User which should be able to immediately use the credentials to log himself in. I am using the following section in the documentation to do so: https://developer.okta.com/docs/api/resources/users.html#create-user-with-password

The user is added successfully. When attempting to login the new user (using the  {{url}}/api/v1/authn API), I keep getting "Authentication failed". The Okta log shows "VERIFICATION_ERROR". I want the user to be authenticated even if a verification has not yet been done. Any help is greatly apreciated.
Adrian HaisanAdrian Haisan (Okta, Inc.)
Hi Morten,

Please try this call:
curl -v -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: SSWS ${api_token}" \
-d '{
  "profile": {
    "firstName": "Isaac",
    "lastName": "Brock",
    "email": "isaac.brock@example.com",
    "login": "isaac.brock@example.com",
    "mobilePhone": "555-415-1337"
  },
  "credentials": {
    "password" : { "value": "tlpWENT2m" }
  }
}' "https://{yourOktaDomain}.com/api/v1/users?activate=true"


After the call is done please do test it out. It should give no further errors for the Verification.
Morten LilengMorten Lileng
Hi Adrian, this did indeed help - thanks! I got this to work with the pure RESTful call. I had to update the Okta-provided Java SDK to use the newest snapshot versions to get access to the 'setActive(...)' method :

[...]
    // Security API
    compile 'com.okta.sdk:okta-sdk-api:0.6.1-SNAPSHOT'
    compile 'com.okta.sdk:okta-sdk-impl:0.6.1-SNAPSHOT'
    compile 'com.okta.sdk:okta-sdk-httpclient:0.6.1-SNAPSHOT'

[...]
User user = UserBuilder.instance()
   .setEmail(jsonRequestBody.getString("email"))
   .setFirstName(jsonRequestBody.getString("given_name"))
   .setLastName(jsonRequestBody.getString("surname"))
   .setPassword(jsonRequestBody.getString("password"))
   .setActive(true)
   .buildAndCreate(client);