Ross
May 4, 2020, 3:28am
1
After logging in to my SPA, the browser is caught in a loop calling the /implicit/callback URL.
Here is auth config in Vue:
Vue.use(Auth, {
issuer: ‘https://dev-218542.okta.com/oauth2/default ’,
clientId: ‘0oaaw0ym1gV6XGPLT4x6’,
redirectUri: ‘http://localhost:8080/implicit/callback ’,
scopes: [‘openid’, ‘profile’, ‘email’],
pkce: true
})
I’ve followed the Okta Vue quickstart, along with the tutorial here: developer dot okta dot com/blog/2018/11/20/build-crud-spring-and-vue
Thanks!
Can you please post all the code in your router file?
Ross
May 6, 2020, 4:45pm
3
Sure. I have also reviewed your tutorial, but I’m not using TS here. Thanks!
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Auth from '@okta/okta-vue'
Vue.use(Auth, {
issuer: 'https://dev-*******.okta.com/oauth2/default',
clientId: '*********',
redirectUri: 'http://localhost:8080/implicit/callback',
scopes: ['openid', 'profile', 'email'],
pkce: true
})
Vue.use(VueRouter)
const routes = [
{
path: '/',
name: 'Home',
component: Home,
meta: {
requiresAuth: true
}
},
{
path: '/clients',
name: 'Clients',
component: () => import(/* webpackChunkName: "clients" */ '../views/Clients.vue'),
meta: {
requiresAuth: true
}
},
{
path: '/implicit/callback',
component: Auth.handleCallback()
}
]
const router = new VueRouter({
routes
})
router.beforeEach(Vue.prototype.$auth.authRedirectGuard());
export default router
Which tutorial are you using? This one uses JavaScript, not TypeScript:
Ross
May 7, 2020, 1:12am
5
Yes that is the one, was just saying a also consulted https://developer.okta.com/blog/2018/12/03/bootiful-spring-boot-java-vue-typescript which seems similar in terms of auth server config.
I believe this is because you have requiresAuth: true
for your /
route. I’d suggest looking at the Vue SDK docs to see how to redirect to another URL (/
is the default). I haven’t done this personally. If you can’t figure it out, please enter an issue in the GitHub project.
system
Closed
January 24, 2024, 7:15pm
7
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.