# Redirect Issue: Successfully Logging in with Okta but Redirected to Okta Dev Dashboard Instead of redirectUri

**URL:** <https://devforum.okta.com/t/redirect-issue-successfully-logging-in-with-okta-but-redirected-to-okta-dev-dashboard-instead-of-redirecturi/26502>\
**Category:** Questions\
**Created:** [January 26, 2024, 7:40pm UTC](https://devforum.okta.com/t/redirect-issue-successfully-logging-in-with-okta-but-redirected-to-okta-dev-dashboard-instead-of-redirecturi/26502 "2024-01-26T19:40:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![HappyEngineer](https://avatars.discourse-cdn.com/v4/letter/h/5f9b8f/32.png) [@HappyEngineer](https://devforum.okta.com/u/HappyEngineer)\
**Post date:** [January 26, 2024, 7:40pm UTC](https://devforum.okta.com/t/redirect-issue-successfully-logging-in-with-okta-but-redirected-to-okta-dev-dashboard-instead-of-redirecturi/26502/1 "2024-01-26T19:40:58Z")

</div>

```auto
const oktaAuth = new OktaAuth({
    issuer: 'https://dev-xx.okta.com',
    clientId: 'xxxx',
    redirectUri: 'https://localhost:3000/login?next=/home',
    scopes: ['openid', 'profile', 'email']
  })

```

```auto
<v-btn @click="clickFn()">
     {{ "Login with Okta"}}
</v-btn>

clickFn: async () => {
      try {
        await oktaAuth.signInWithRedirect()
      } catch (e) {
        console.log(e)
      }
    }

```

I added a ‘Login with Okta’ button on my SPA using `oktaAuth.signInWithRedirect`, but it didn’t redirect back to the `redirectUri` after I logged in on the Okta login page.  
Here’s the steps:

1. I clicked the ‘Login with Okta’ button, and the page redirected to the Okta login page.
2. I clicked ‘Sign in with Google’ to log in.
3. After logging in using my Google account, the page redirected back to the Okta login page.
4. Then the page redirected to the Okta dev dashboard, but not to the `redirectUri`.

I tried `oktaAuth.signInWithRedirect(originalUri: '')`, but it didn’t work.  
Any suggestions would be greatly appreciated!

My settings:

 ![2.33.41](https://global.discourse-cdn.com/oktadev/original/2X/3/31d517dd4019c1676892dff2ca673b1c3effd7bc.png)  
 ![2.40.32](https://global.discourse-cdn.com/oktadev/original/2X/2/26c5b51731d2bb9d3147cf95e2ea5a9f9a2b206d.png)

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [January 26, 2024, 8:01pm UTC](https://devforum.okta.com/t/redirect-issue-successfully-logging-in-with-okta-but-redirected-to-okta-dev-dashboard-instead-of-redirecturi/26502/2 "2024-01-26T20:01:06Z")

</div>

Are you using an Okta Classic org, or an Okta Identity Engine org?

What you’re describing sounds similar to a limitation in Okta Classic that, in a self-hosted widget, Federated Users (e.g. users from an external IdP like Google) will only be logged into Okta, but the /authorize request is not made (this is mentioned in the widget readme [here](https://github.com/okta/okta-signin-widget/blob/master/docs/classic.md#idp-discovery)).

If this is an Okta Classic org, there’s a solution for this outlined here: [Social auth redirect not working with Okta Sign-In Widget | Okta Help Center](https://support.okta.com/help/s/article/Social-Auth-redirect-not-working-with-Okta-Signin-Widget?language=en_US)

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [January 26, 2024, 8:04pm UTC](https://devforum.okta.com/t/redirect-issue-successfully-logging-in-with-okta-but-redirected-to-okta-dev-dashboard-instead-of-redirecturi/26502/3 "2024-01-26T20:04:24Z")

</div>

I should note that that solution still requires your application to issue an /authorize request itself. Setting the fromURI as in that example only ensures the user isn’t redirected to the dashboard, but the OAuth flow will not be made until your application kicks it off

---

<div class="post-metadata">

**Author:** ![HappyEngineer](https://avatars.discourse-cdn.com/v4/letter/h/5f9b8f/32.png) [@HappyEngineer](https://devforum.okta.com/u/HappyEngineer)\
**Post date:** [January 26, 2024, 8:27pm UTC](https://devforum.okta.com/t/redirect-issue-successfully-logging-in-with-okta-but-redirected-to-okta-dev-dashboard-instead-of-redirecturi/26502/4 "2024-01-26T20:27:16Z")

</div>

Thanks for your reply!!!  
I’m new to Okta development, could you talk more about how to make /authorize request in this case? I’ve gone through the post you shared, but the solution is still unclear to me, does it means I should replace `window.location.href = " https://{ oktaDomain}/sso/idps/{googleIdpId}?fromURI=" +encodeURI(redirectUrl);` with `await oktaAuth.signInWithRedirect()`?  
By the way, I use `@okta/okta-auth-js` but not Okta-Sign-In Widget.

---

<div class="post-metadata">

**Author:** ![HappyEngineer](https://avatars.discourse-cdn.com/v4/letter/h/5f9b8f/32.png) [@HappyEngineer](https://devforum.okta.com/u/HappyEngineer)\
**Post date:** [January 26, 2024, 8:54pm UTC](https://devforum.okta.com/t/redirect-issue-successfully-logging-in-with-okta-but-redirected-to-okta-dev-dashboard-instead-of-redirecturi/26502/5 "2024-01-26T20:54:00Z")

</div>

Thanks!!! I edited the link of ‘sign with google’ on the Customized Help Links section, and it can redirect correctly now! Thanks!!!

---

<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 27, 2024, 8:54pm UTC](https://devforum.okta.com/t/redirect-issue-successfully-logging-in-with-okta-but-redirected-to-okta-dev-dashboard-instead-of-redirecturi/26502/6 "2024-01-27T20:54:49Z")

</div>

Closed on January 27, 2024, 8:54pm UTC

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