Incorrect redirectUri when using Okta sign in widget as a separate package

Hi there,

I have, hopefully, a simple issue to resolve. We are building a login app with okta and using their react widget for the process. We wanted to wrap up the widget and make it a shared packages that some other apps can pull in and use as well, with our styles and configurations.

When the okta widget code is directly within our custom web app, it works fine. However, when it’s pulled in via a wrapped npm package, it doesn’t. I’ve narrowed it down to an issue in the redirectUri.

working: http://localhost:3000/apps#code=dfGd_
not working: http://localhost:3000/apps?code=F-

You can see that it winds up using a ‘?’ instead of a ‘#’ when it’s pulled in as a package. If I change the ‘?’ to a ‘#’ with the redirect url provided, it works as expected. I cannot figure out how or why this would be happening… i’m looking through my wrapper code but it’s effectively the same… I’m at a bit of a loss.

if you are using PKCE, query will be the default response mode and you will need to set it manually to fragment; posting the github reference below for additional context

authParams: {
responseMode: ‘fragment’
1 Like

This was exactly it, thank you! For whatever reason, the one that was baked into our code was using fragment by default somehow, so when i migrated it to a wrapper package, that wasn’t happening and it was defaulting to ‘?’. Anyway, thanks alot for your help!!