okta-vue plugin supports both Options API (via mixin that exposes only computable authState) and Composition API (by providing new injectable with name okta.authState). If flag __VUE_OPTIONS_API__ is false, user should inject okta.authState and return authState property from setup.
New mixin code is more efficient. Previously every component was subscribing (and unsubscribing on destroy) to auth state update, now there is one global subscriber. Using shallowRef and triggerRef is also more sufficient and error-prone (fixes #129)
LoginCallback component migrated to Composition API
Test app migrated to Composition API
Updated Protected page in test app - show access token claims and button to renew token (to demonstrate reactivity of authState)
Resolves #128 , #129
Internal ref: OKTA-645251
PR to update samples: https://github.com/okta/samples-js-vue/pull/160
Chnages:
okta-vue
plugin supports both Options API (via mixin that exposes only computableauthState
) and Composition API (by providing new injectable with nameokta.authState
). If flag__VUE_OPTIONS_API__
is false, user should injectokta.authState
and returnauthState
property fromsetup
.shallowRef
andtriggerRef
is also more sufficient and error-prone (fixes #129)LoginCallback
component migrated to Composition APIauthState
)