Okta Vue Guide Code Not working

I am following the okta vue guide document.
I am getting the error ‘Uncaught TypeError: Cannot call a class as a function’.

The code is index.js on the router side and is as follows

import Auth, {LoginCallback} from’@okta/okta-vue’
const oktaConfig = {
clientId: process.env.VUE_APP_OKTA_CLIENT_ID,
issuer: process.env.VUE_APP_OKTA_ISSUER,
redirectUri: process.env.VUE_APP_OKTA_REDIRECT_URL,
scopes: [‘openid’,‘profile’,‘email’],
responseType: [“id_token”, “token”],
pkce: false
};
Vue.use(Auth, oktaConfig)

The part where the error occurs is at the bottom of “Vue.use(Auth, oktaConfig)”.

Can you determine the cause of the problem?

@shjeong Hi, it looks like oktaConfig is not parsed with correct type.
Please try the below example:

import Vue from ‘vue’
import { OktaAuth } from ‘@okta/okta-auth-js’
const oktaAuth = new OktaAuth({
issuer: ‘https://{yourOktaDomain}.com/oauth2/default’,
clientId: ‘{clientId}’,
redirectUri: window.location.origin + ‘/login/callback’,
scopes: [‘openid’, ‘profile’, ‘email’]
})

More details can be found in this link

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