Redirect user to Okta widget for activation flow


#1

Hi,

I am using Okta widget with customization of css, error messages and want to implement user activation flow using my custom login page. I have modified user activation email template to redirect user to custom login page with activation link.

Now my query is how to instruct Okta widget to start in user activation mode?

Regards,
ashu


#2

Ping @remanc - is it possible to bootstrap the widget in user activation mode?


#3

It looks like there’s currently no way to bootstrap the widget with the activation token, but we do now have an endpoint (doc’ed here).

One way to trigger this is just using AuthJS and calling the signIn method directly and passing that in. We do have an example in the widget code where we’re doing this (here), but unfortunately it’s part of registration-as-a-service, which I don’t think is GA yet.


#4

For future people looking for this answer… I found the following answer on SO (https://stackoverflow.com/a/40730002) and it seems to work.

It’s currently undocumented, but there is a way. You can bootstrap the widget with the stateToken you receive from your initial primary auth request, so you can do this:

Make your request via the API. You will receive in the response one of the MFA statuses (i.e. MFA_REQUIRED), as well as stateToken.
Pass the stateToken into the widget when you initialize it:
The widget will use this stateToken to bootstrap itself into the same state - this works for any transaction state.

 var signIn = new OktaSignIn({
       baseUrl: 'https://yourOrg.okta.com',
       stateToken: 'TheStateTokenInYourPrimaryAuthResponse',
       // any other config options you'd normally pass in
 });