# After login with microsoft login redirect to mydomain.com/app/userhome

**URL:** <https://devforum.okta.com/t/after-login-with-microsoft-login-redirect-to-mydomain-com-app-userhome/6893>\
**Category:** Questions\
**Tags:** widget\
**Created:** [November 13, 2019, 9:47pm UTC](https://devforum.okta.com/t/after-login-with-microsoft-login-redirect-to-mydomain-com-app-userhome/6893 "2019-11-13T21:47:11Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ymzhang23](https://avatars.discourse-cdn.com/v4/letter/y/da6949/32.png) [@ymzhang23](https://devforum.okta.com/u/ymzhang23)\
**Post date:** [November 13, 2019, 9:47pm UTC](https://devforum.okta.com/t/after-login-with-microsoft-login-redirect-to-mydomain-com-app-userhome/6893/1 "2019-11-13T21:47:11Z")

</div>

Hello everybody,

From the developer console, I made a custom sign-in page. I have added a login button from the Mircosoft. It does work, but after login, I am being redirected to [https://mydomain.com/app/userhome](https://mydomain.com/app/userhome). Is there a way to change this. Here is the code I used:

```
<title>{{pageTitle}}</title>
{{{SignInWidgetResources}}}

```

```
<!--
    "OktaUtil" defines a global OktaUtil object
    that contains methods used to complete the Okta login flow.
 -->
{{{OktaUtil}}}

<script type="text/javascript">
	var config = {
    	baseUrl: orgUrl,
             idps: [
          {id: 'this_is_private', text: 'Login met Microsoft'}
        ]
    }

    // Render the Okta Sign-In Widget
    var oktaSignIn = new OktaSignIn(config);
    oktaSignIn.renderEl({ el: '#okta-login-container' },
      function success(res) {
        	if(res.status === 'SUCCESS'){
              res.session.setCookieAndRedirect(http://localhost:8080);

      },
     
      function error(err) {
        // This function is invoked with errors the widget cannot recover from:
        // Known errors: CONFIG_ERROR, UNSUPPORTED_BROWSER_ERROR
      }
    );
</script>

```

---

<div class="post-metadata">

**Author:** ![dragos](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/dragos/32/1313_2.png) [@dragos](https://devforum.okta.com/u/dragos)\
**Post date:** [November 14, 2019, 12:31am UTC](https://devforum.okta.com/t/after-login-with-microsoft-login-redirect-to-mydomain-com-app-userhome/6893/2 "2019-11-14T00:31:47Z")

</div>

Hi @ymzhang23

You can configure the widget to do a simple OIDC flow and redirect you to a specific page once the flow is completed. You can find [here](https://developer.okta.com/docs/guides/implement-implicit/overview/) an example for implicit flow.

From widget point of view, you will need to set a few more attributes under config:

- redirectUri - the URL where to redirect (this needs to be whitelisted also in the OIDC app in Okta)
- clientId: the OIDC app’s client ID which can be found under the General tab
- authParams.issuer - the issuer of the authorization server used
- authParams.responseType - id\_token, token or both
- authParams.display - “page”
- authParams.scopes - the scopes requested (it can be set to openid)

Here is an example of a configuration

```auto
var oktaSignIn = new OktaSignIn({
    baseUrl: "https://org.okta.com",
    clientId: "0oall5cfosYwGzfFA0h7",
    redirectUri: "https://your.website.com/page/to/be/accessed",
    authParams: {
        issuer: "https://org.okta.com",
        responseType: ['token'],
		display: 'page',
		scopes: ['openid']
    }
});

```

---

<div class="post-metadata">

**Author:** ![ymzhang23](https://avatars.discourse-cdn.com/v4/letter/y/da6949/32.png) [@ymzhang23](https://devforum.okta.com/u/ymzhang23)\
**Post date:** [November 14, 2019, 8:21am UTC](https://devforum.okta.com/t/after-login-with-microsoft-login-redirect-to-mydomain-com-app-userhome/6893/3 "2019-11-14T08:21:13Z")

</div>

Thank you for you reaction.

Unfortunately, you solution doesnt work. I have applied this, and still it keep me redirect to [mydomain.com/app/userHome](http://mydomain.com/app/userHome)

---

<div class="post-metadata">

**Author:** ![dragos](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/dragos/32/1313_2.png) [@dragos](https://devforum.okta.com/u/dragos)\
**Post date:** [November 14, 2019, 8:23am UTC](https://devforum.okta.com/t/after-login-with-microsoft-login-redirect-to-mydomain-com-app-userhome/6893/4 "2019-11-14T08:23:02Z")

</div>

Hi @ymzhang23

Can you please open a support ticket with us at [developers@okta.com](mailto:developers@okta.com) in order to review the integration mentioned above?

---

<div class="post-metadata">

**Author:** ![ymzhang23](https://avatars.discourse-cdn.com/v4/letter/y/da6949/32.png) [@ymzhang23](https://devforum.okta.com/u/ymzhang23)\
**Post date:** [November 14, 2019, 10:24am UTC](https://devforum.okta.com/t/after-login-with-microsoft-login-redirect-to-mydomain-com-app-userhome/6893/5 "2019-11-14T10:24:25Z")

</div>

Hi @dragos,

Do you mean sending an email to [developers@okta.com](mailto:developers@okta.com)?

Thank you again.

---

<div class="post-metadata">

**Author:** ![dragos](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/dragos/32/1313_2.png) [@dragos](https://devforum.okta.com/u/dragos)\
**Post date:** [November 14, 2019, 10:43am UTC](https://devforum.okta.com/t/after-login-with-microsoft-login-redirect-to-mydomain-com-app-userhome/6893/6 "2019-11-14T10:43:01Z")

</div>

Hi @ymzhang23

Yes, please send us an email to [developers@okta.com](mailto:developers@okta.com) and one of our Developer Support Engineers will assist you.

---

<div class="post-metadata">

**Author:** ![ymzhang23](https://avatars.discourse-cdn.com/v4/letter/y/da6949/32.png) [@ymzhang23](https://devforum.okta.com/u/ymzhang23)\
**Post date:** [November 14, 2019, 11:18am UTC](https://devforum.okta.com/t/after-login-with-microsoft-login-redirect-to-mydomain-com-app-userhome/6893/7 "2019-11-14T11:18:42Z")

</div>

Hello @dragos,

Thank your for your message. I just send you an email.

---

<div class="post-metadata">

**Author:** ![ilyas.patel](https://avatars.discourse-cdn.com/v4/letter/i/e480ec/32.png) [@ilyas.patel](https://devforum.okta.com/u/ilyas.patel)\
**Post date:** [December 9, 2019, 9:38am UTC](https://devforum.okta.com/t/after-login-with-microsoft-login-redirect-to-mydomain-com-app-userhome/6893/8 "2019-12-09T09:38:43Z")

</div>

Hello @ymzhang23 I want to create a same , Did you app redirect the givem URL ?

---

<div class="post-metadata">

**Author:** ![ymzhang23](https://avatars.discourse-cdn.com/v4/letter/y/da6949/32.png) [@ymzhang23](https://devforum.okta.com/u/ymzhang23)\
**Post date:** [December 10, 2019, 9:51am UTC](https://devforum.okta.com/t/after-login-with-microsoft-login-redirect-to-mydomain-com-app-userhome/6893/9 "2019-12-10T09:51:07Z")

</div>

Yes, but I had to fill in in the parameters. not in the config.

```
customButtons: [{
                title: 'Login met Microsoft',
                className: 'btn-microsoft',
                click: function() {
                  // clicking on the button navigates to another page
                  window.location.href = 'youroktadomain.com/redirect_uri=https://www.google.com&state=WM6D&nonce=YsG76jo';
                }
              }
```

---

<div class="post-metadata">

**Author:** ![ilyas.patel](https://avatars.discourse-cdn.com/v4/letter/i/e480ec/32.png) [@ilyas.patel](https://devforum.okta.com/u/ilyas.patel)\
**Post date:** [December 12, 2019, 7:36am UTC](https://devforum.okta.com/t/after-login-with-microsoft-login-redirect-to-mydomain-com-app-userhome/6893/10 "2019-12-12T07:36:17Z")

</div>

HI @ymzhang23,  
so is your location.href redirect to [google.com](http://google.com) and what state contain and noonce ,  
and as per suggest by @dragos

```
https://${orgnaizationdomain.okta.com}/oauth2/default/v1/authorize?response_type=id_token%20token&client_id=${client_id}&redirect_uri=${mydomain/dashboard}&state=abc&scope=openid&nonce=abc

```

I have tried but its not work for me , I need same as facebook work in Okta , it redirect to Fb , but I want to redirect to Okta login and after success to my home page

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [January 18, 2024, 12:41am UTC](https://devforum.okta.com/t/after-login-with-microsoft-login-redirect-to-mydomain-com-app-userhome/6893/11 "2024-01-18T00:41:36Z")

</div>

Closed on January 18, 2024, 12:41am UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
