I am attempting to integrate the okta signin widget into a Vue 3 project, based on the following: (Okta Sign-In Widget and Vue | Okta Developer). However, it appears that OktaSignIn is not available to import into the config files even after installing via yarn add @okta/okta-signin-widget. In other words, I cannot add import OktaSignIn from '@okta/okta-signin-widget' to the main.ts, as the package does not appear to be available. Is this widget not yet available for Vue 3 or Vue CLI 4 ?
Example:
import OktaSignIn from '@okta/okta-signin-widget'
import { OktaAuth } from '@okta/okta-auth-js'
const oktaSignIn = new OktaSignIn({
baseUrl: 'https://${yourOktaDomain}',
clientId: '${clientId}',
redirectUri: 'http://localhost:8080/login/callback',
authParams: {
pkce: true,
issuer: 'https://${yourOktaDomain}/oauth2/default',
display: 'page',
scopes: ['openid', 'profile', 'email']
}
});
const oktaAuth = new OktaAuth({
issuer: 'https://${yourOktaDomain}/oauth2/default',
clientId: '${clientId}',
redirectUri: window.location.origin + '/login/callback',
scopes: ['openid', 'profile', 'email']
})
export { oktaAuth, oktaSignIn };
By "the package does not appear to be available", I assume you're referring to this TypeScript error:
That module does not yet support its own typings, but there's an open PR for it. As a workaround, you can declare the typings in your project at
src/okta-signin-widget.d.ts, based on the PR's changes: