Create Activated User without Credentials Flow issue okta api

api

#1

Hello,

I have been able to create a new activated user without credentials using okta api {{url}}/api/v1/users?activate=true. So once the user is created and activated since activate is true, the user receives an email. Once the user clicks on the reset password/activate account link, this link brings him to a page where he creates his password etc and clicks a button Create Account. This is where the button, instead of redirecting the user to my app routes him to the following url where it asks the user to add apps link below.

https://dev-179941.oktapreview.com/app/UserHome

Is there a way after the user creates the password and clicks on this button the user can be redirected to my app url for e.g: http://abc.com/home or for now http://localhost:3000/home.

Thanks.

Aakash.


#2

So here is what you do.

Create a bookmark app in Okta with redirection link. Go to the app and take the relative url from
Embedded app.

If you using Okta activation email template. Append the activation link with ?fromURI=


#3

Hi Krish, Thanks for the note. Is there documentation that you can point me to create bookmark app in the developer console?


#4

Hi @mraible would you be able to point me to any documentation on how to avoid the problem I described. Thanks in advance.


Cannot Login to Okta Developer Console and app login redirect links throws 404 Page not found
#5

You might have to switch to the Classic UI (in the top left corner). Here’s a help article about creating bookmark apps. https://support.okta.com/help/answers?id=9062A000000QuSAQA0


#6

I still cannot get this bookmark thing working to redirect the new user back to my application home page once the password creation etc is complete.

A new user signs up with the following info from the angular front end. firstName, lastName, email, login and mobilePhone.

This data is received at my nodejs backend and below is what I am using for creating the new user with okta nodejs sdk.

const okta = require('@okta/okta-sdk-nodejs');

const client = new okta.Client({
  orgUrl: 'https://dev-179941.oktapreview.com/',
  token: '{{mytoken}}'    // Obtained from Developer Dashboard
});

app.post('/usersignupokta', function(req,res){
  var newUser = {
                  profile: {
                    firstName: req.body.profile.firstName,
                    lastName: req.body.profile.lastName,
                    email: req.body.profile.email,
                    login: req.body.profile.login,
                    mobilePhone: req.body.profile.mobilePhone,
                  }
  };

  client.createUser(newUser).then(user => {
            console.log('Created user', user);
  }).catch((err) => console.error(err));
});

At this point I can see in okta developer console and in my node app console that the new user has been created and has received the activation email. The activation link in the email is something like this.

I am using the User Activation email template where the code for the activation link is as below.

<a href="${activationLink}" id="reset-password-link">${activationLink}</a>

Once the user clicks on this link he is redirected to a screen where he sets his new password, security question and security image and clicks on Create My Account button. At this point I was hoping that the user would be redirected to my application home page http://localhost:3000/home but he gets redirected to https://dev-179941.oktapreview.com/app/UserHome where he sees the screen below.

Is there step by step guidance what needs to be done to get the user back to my application homepage and not get stuck at this other page?

Thanks.


#7

@aakashb FYI we are working on functionality to redirect the user back to your application (instead of /UserHome) after clicking through an activation email. See here: Redirect to Login or Application After Activation

The linked post above also includes a workaround that you can use today. cc @tom


Cannot Login to Okta Developer Console and app login redirect links throws 404 Page not found
#8

Thanks for the update @nate.barbettini. Any ETA? If this feature is released within a month I don’t see a reason for me to code the workaround or search for a solution other than Okta. Thank you.


#9

I believe if you are searching for something to get out the door in the month, the workaround mentioned in:

is the only option.

I have a question for you, are you OK collecting the password upfront? The registration as a service feature, if you can collect the password upfront will behave the way that you expect, you will be able to either require or defer email verification, but it will require that you collect the primary credential up front. This feature, in particular, is on our short-term roadmap, and the team is currently working on it. We are currently tracking towards ~ Oktane '18, but please remember, dates can change.

You can watch https://support.okta.com/help/OktaProductRoadMap, this feature is called Self-Service Registration.

Hope this helps,
Tom


#10

Yes @tom I can collect the password upfront from the user signing up. I will give it a shot with credentials upfront and post an update here.