-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Okta Auth plugin internally fails with an undefined instance of this.oktaAuth which leads to our Web SPA failing on startup and each route change. #14
Comments
Also an update: as we employ workarounds, we are noticing this logged error:
When searching for this topic, I come across this lively Github issue here. Is there a known solution for this problem that has yet to be officially documented? |
@CVANCGCG Based on the error "Cannot read property 'oktaAuth' of undefined", It looks like It could be that the install method has not been called yet. It may also be possible that the constructor is throwing an exception. If you are able to set a breakpoint in the debugger in this function you should be able to see what is happening. This error: "OAuthError: The client specified not to prompt, but the user is not logged in." will occur during token renew or any call to |
@aarongranick-okta, I've enabled source maps in vue.config.js as follows.
Unfortunately the source code I'm debugging is a tokenized version and not what I expect. Here's a screenshot. Do you see anything wrong that is causing that esoteric transformed JS code? Suppose we fix the source map for the okta distribution, what would we walk it back to in our application code? Do you see anything unexpected with my initialization of the Auth plugin and use of route guards? It appears to be standard and consistent with the Okta developer guidance? |
To include sourcemaps, the Having the sourcemaps will make it easier to debug the code. This line in your code:
should create an instance of the auth service and attach it to the Vue prototype as The most common reasons why an error would occur during construction are invalid configuration or insufficient browser capabilities (such as on IE, which requires a polyfill). The error trace shows the error being thrown at |
The problem may be caused by the logic in |
Hi @aarongranick-okta, I appreciate the suggestion and will test this approach. |
I'm submitting a:
Current behavior
Our Vue single page application fails on startup and displays a blank page stemming from an error that originates from within the Okta Plugin within @okta/okta-vue/Auth.js that indicates the internal instance of await oktaAuth is undefined and fails to establish a user identity from an accessToken/idToken.
Expected behavior
We expect the normal behavior where the redirect to Okta to result in either in a successful login or refresh of the existing access and id token. In either case we expect the library to always internally resolve to a defined (non-null and non-undefined) instance in all of the references to: "this.oktaAuth"
Minimal reproduction of the problem with instructions
Note: In the code snippet below, you see that our initialization of the Auth plugin uses defaults that result in autoRenew: true and the use of local storage. And because our application displays confidential data, we take a vigilant approach to checking the user on each route change that uses the router::beforeEach() and router::beforeResolve() event hooks. The intent is to ensure we authenticate users and renew session tokens via router::beforeEach() event and subsequently invalidate/synchronize the user in the router::beforeResolve() event handler.
npm run serve
Extra information about the use case/user story you are trying to implement
We need to ensure each user is authenticated and has a valid access token before access is granted to the application and data is displayed via APIs.
Environment
node -v
): 12.0.0The text was updated successfully, but these errors were encountered: