Social login redirects to Okta dashboard instead of localhost

Hi,

I am using the OktaSignInWidget and it redirects to Okta userHome after login with Google. I want it to redirect to my application running on localhost. Is there some setting I am missing in the widget config?

Here is my code -

const widget = new OktaSignIn({
baseUrl: oktaConfig.baseUrl, // this is {myOrg}.okta.com url that Okta created for me
idps: [{ type: ‘GOOGLE’, id: ‘*****’ }],
authParams: {
display: ‘popup’
}
});

Hi @devpriya,

I believe you’re missing the redirect_uri parameter in your widget configuration.
You can see all the widget parameters here - GitHub - okta/okta-signin-widget: HTML/CSS/JS widget that provides out-of-the-box authentication UX for your organization's apps

You can also look at the following 2 threads -

Hey Vijet,

I tried the suggestions in the threads you had suggested but none of them seem to work, I still get redirected to Okta’s app/userHome instead of my localhost. Here is the updated config -

const widget = new OktaSignIn({
baseUrl: oktaConfig.baseUrl,
redirectUri: ${window.location.origin}/callback,
idps: [{ type: ‘GOOGLE’, id: ‘*****’ }],
features: {
idpDiscovery: true
},
idpDiscovery: {
requestContext: ${window.location.origin}/callback
}
});

I also tried this combination -

const widget = new OktaSignIn({
baseUrl: oktaConfig.baseUrl,
redirectUri: ${window.location.origin}/callback,
idps: [{ type: ‘GOOGLE’, id: ‘*****’ }]
});

BTW, others are also facing the same issue, here is another thread from January - Social identity provider redirection

If this is something in config that I am missing then please let me know and also update your docs/examples with explicit instructions.

Hi @devpriya

Can you please check if the URL that you are passing in the redirect_uri query parameter on /authorize endpoint is added in Okta under Admin >> Security >> API >> Trusted Origins (or Admin >> API >> Trusted Origins if using the developer console) with redirect option enabled?

@dragos Yes, I am doing that.

Bumping this up!

Guys this is urgent as I am evaluating Okta for my use-case. My requirement is very simple and I am really hoping that Okta works for something as simple as this.

Hi @devpriya

Can you please open a support case with us through an email to developers@okta.com in order to further review this use-case and provide the next steps?

I’m stuck with the same issue… I don’t know how many hours I spent on this, frustrating as this is the most simplest usecase -> Authenticate with Okta then redirect to custom page… Don’t understand why this is so HARD

For anyone still trying to get this working, take a look at the following KB article describing how to create custom buttons in the widget so that users can be redirected to a different location than the Okta dashboard: Social Auth redirect not working with Okta Sign-in Widget

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