How to redirect users to custom web page after sign in from okta sign in widget?

Hi All,

I’m building a React web app.
I used Okta sign in widget code for setting up sign in page.
Once user provides the credentials and click on Sign in button its re-directing to Okta userHome page,
but i need to re-direct it to custom web page, instead of Okta userHome page.
Can someone help me with this.
Thanks in advance.

var oktaSignIn = new OktaSignIn(config);
  // 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') {
                } else {


  function error(err) {
    //handle errors

This is how I redirect, after a success response we set a cookie redirect.

Thanks for the response.
where we need to set this exactly?
is it inside the Okta signin widget code or this is all together in a separate class?

This is in the javascript of the okta widget, so on the page where you want the okta widget to render.