okta / okta-vue

OIDC SDK for Vue
https://github.com/okta/okta-vue
Other
46 stars 25 forks source link

Incorrect interface OktaVueOptions #121

Closed garretmh closed 1 year ago

garretmh commented 1 year ago

Describe the bug?

The OktaVueOptions interface is incorrect. The onAuthRequired and onAuthResume properties are both marked as required but should be optional.

export interface OktaVueOptions {
  oktaAuth: OktaAuth;
- onAuthRequired: OnAuthRequiredFunction;
- onAuthResume: OnAuthRequiredFunction;
+ onAuthRequired?: OnAuthRequiredFunction;
+ onAuthResume?: OnAuthRequiredFunction;
}

What is expected to happen?

According to the docs, using the OktaVue plugin with just oktaAuth defined should work.

What is the actual behavior?

In TypeScript projects, when using the OktaVue plugin both onAuthRequired and onAuthResume are required.

Reproduction Steps?

  1. Create a Vue project with TypeScript.
  2. Follow the configuration from the README:
// main.ts

import { createApp } from 'vue'
import { OktaAuth } from '@okta/okta-auth-js'
import OktaVue from '@okta/okta-vue'

const oktaAuth = new OktaAuth({
  issuer: 'https://{yourOktaDomain}/oauth2/default',
  clientId: '{clientId}',
  redirectUri: window.location.origin + '/login/callback',
  scopes: ['openid', 'profile', 'email']
})

const app = createApp(App)
app.use(OktaVue, { oktaAuth })
app.mount('#app')

SDK Versions

Execution Environment

Additional Information?

No response

denysoblohin-okta commented 1 year ago

Thanks for submitting this issue. Internal ref: OKTA-575263

Ancient-Dragon commented 1 year ago

Any updates to this? Currently facing this issue as well

tenyo commented 1 year ago

I ran into the same issue and was able to narrow it down to vue v3.2.46 (https://github.com/vuejs/core/releases/tag/v3.2.46) - hope that helps.

For now my workaround is:

"vue": "=3.2.45"
Ancient-Dragon commented 1 year ago

You can also just use:

app.use(OktaVue, { oktaAuth } as any)

That way you can continue to use the latest version of vue.

jaredperreault-okta commented 1 year ago

Btw, this was fixed in v 5.6.0