New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Okta Auth JS library not redirecting to originalURI #1356
Comments
Have you tried passing the specific redirect path to this.$auth.signInWithRedirect({originalUri: '/form/company/1234'}) |
Hi Jared, Thanks for your response. Yes, I have tried this but the web browser keeps refreshing between these two URLs. One is referencing login callback router under the root context of application i.e. http://localhost:8080/form/company and another one is referencing it directly under the host address i.e. http://localhost:8080/, see below This is what I have tried in my code and it's called after user is sent back to the application by Okta.
Looks like Okta keeps appending the root context every time a refresh occurs. below is what I see in console when the code hits this line -> console.log(oktaAuth.getOriginalUri()); I also notice that both auth.token.isLoginRedirect() and authState.isAuthenticated() are always returning false. Thanks, |
Make sure your |
I don't think this route is gated by any authentication logic unless
I see what you are saying that route should handle callback before any authentication logic is called but I don't have any logic. Thanks |
Also, program always enters this if block since
|
So here is the thing. It works if I change my application base to "/" i.e. http://localhost:8080/ and now signInWithRedirect sends request to http://localhost:8080/ and I am able to navigate to http://localhost:8080/1234. But it gets stuck at /login/callback URL as soon as I change the application base to 'form/company'. I even tried |
For me, I didn't have the correct implementation of vue-router, as soon as I implemented an empty front page with a |
Closing this issue, please re-open if needed |
Describe the bug?
Hi,
I have an existing VueJS 3.0 project that has only one page and I am trying to integrate it with Okta using @okta/okta-vue ^5.5.0 and @okta/okta-auth-js ^7.0.0 libraries. I am using TypeScript and VueJs 3.0 Composition API. I am trying it with Okta hosted login.
I am trying to load the application after user logs in via Okta but the application is always stuck at /login/callback URI that comes with code and state query strings. I can see the user information with parseFromUrl() function. I can also see original URI with oktaAuth.getOriginalUri() function but the request never lands that page.
I have gone through multiple Okta documentation and found that Okta library must be sending user to originalURI after a successful login but it's not happening in my case.
What is expected to happen?
I would like user to hit http://localhost:8080/form/company/1234 and redirect to Okta in case user wasn't authenticated earlier and it seems to be working fine but user is not returning to this URL after a successful Okta login.
What is the actual behavior?
Here is my router configuration:-
`const router = createRouter({
history: createWebHistory("/form/company"),
routes: [
],
})
router.beforeEach(navigationGuard);
export default router;;`
Okta Auth configuration
export const oktaAuth = new OktaAuth({ issuer: 'something', clientId: 'removed', redirectUri: window.location.origin + '/login/callback', pkce: true, })
Here is my App.vue component
`export default defineComponent({
name: 'app',
components: {Header, Spinner},
setup(context, { expose }) {
function login() {
this.$auth.signInWithRedirect({originalUri: '/'})
}
onMounted(async() => {
const auth = getCurrentInstance().appContext.app.config.globalProperties.$auth
},
})`
Reproduction Steps?
Not sure if it's a bug but I might be missing something here.
SDK Versions
"dependencies": {
"@okta/okta-auth-js": "^7.0.0",
"@okta/okta-vue": "^5.5.0",
"@vue/compat": "^3.1.0",
"vue": "^3.2.31",
"vue-router": "^4.0.3",
"dotenv": "^16.0.3"
}
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-plugin-typescript": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"@vue/compiler-sfc": "^3.1.0",
"eslint": "^7.32.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-vue": "^9.7.0",
"typescript": "~4.5.5",
"vue-loader-v16": "npm:vue-loader@^16.1.2"
},
Execution Environment
Chrome, Mozilla Firefox
Additional Information?
No response
The text was updated successfully, but these errors were encountered: