After authentication, forward to custom app

Hello, been stuck with this for awhile, finally trying to figure it out…

My app is located at https://app.nocknock.io, this link forwards it to auth.nocknock.io and after the user logs in, it will automatically for the user to my custom app. However, if the user goes directly to auth.nocknock.io and logs in, they will be forwarded to okta dashboard.

Can I force okta to redirect to my custom app regardless of which web address the user logs in with?

Thanks

Yes - you can have a default redirect that goes to a location of your choosing. This is under Settings->Customization->General. Look for “Default App for Sign-In Widget”.

image

You can also modify the hosted signin widget to set a redirect URI, using OktaUtil.setRedirectUri()

My settings look different… I only see Account options under it.

Apologies; check under Customization.

Thanks. I checked that as well but don’t see the option.

Actually, I’m not using the Sign-in Widget. It uses okta URL for authentication, I just use a custom domain that points to it. So does that mean I need to use the sign-in widget in order for custom redirect?

I usually do this on my okta hosted domain (custom domain)

var oktaSignIn = new OktaSignIn(config);
        oktaSignIn.renderEl(
  // Assumes there is an empty element on the page with an id of 'osw-container'
  {el: '#okta-login-container'},

  function success(res) {
    var url = window.location.href ;
    // The user has successfully completed the authentication flow
    if (res.status === 'SUCCESS') {
              if(url.includes("sometext")){
                res.session.setCookieAndRedirect('custom-redirect-page');
                } else {
                res.session.setCookieAndRedirect('go-to-okta-anyway');
                }
      return;
    }

  },

  function error(err) {
    //handle errors
  }

The feature that chu123 is referring to is likely not enabled in your Org. Can you try enabling the “Global Default Redirect Setting” under Settings > Features and then seeing if that option is available under Customization?

Hi @Ironhide, OMG it works. Thanks! I have been trying to figure this out for such a long time… I go through the quick start guides and did not encounter this…

Hi @andreaskouras, After more digging it looks like I have to enable “Classic UI” to see the “Features” menu. But I don’t have a Global Default Redirect Setting there either… Here’s what I have:

Okay, I just bricked my okta login… I followed your instruction @Ironhide and they work prefectly, but I accidentally placed some invalid javascript code in my success handler and now I can’t log in at all… Do you guys know if I can some how reset the custom code? I completely bricked it…

Hi @broody

Can you please access your org in the form of https://org.okta.com/login/default? The path /login/default would provide a “back-door” to be able to authenticate successfully in cases like this.

You’re awesome! That worked, thank you!

You can also click ‘reset to default’. It will place the original javascript back.

Settings -> customization -> Custom Sign In
There is a white button ‘reset to default’. I have also ruined it a few times so I know where to find that button :stuck_out_tongue: