Skip to content
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

Unable To Obtain Valid Token error #151

Open
richardkshergold opened this issue Sep 14, 2022 · 1 comment
Open

Unable To Obtain Valid Token error #151

richardkshergold opened this issue Sep 14, 2022 · 1 comment

Comments

@richardkshergold
Copy link

Is anyone able to tell me what might cause this method in the library to return the "Unable To Obtain Valid Token". I thought the error might be occurring in our app because the okta service had not yet been fully initialised but I have added some code to prevent the app running the getValidToken() call until the initialisation is complete. At first I thought this had fixed the issue but then (about 24 hours after initial login and lots of testing in the meantime) the call failed again with this error.

getValidToken(buffer = AUTH_EXPIRY_BUFFER) {
        return __awaiter(this, void 0, void 0, function* () {
            if (this._tokenSubject.value) {
                if (!this._tokenSubject.value.isValid(buffer)) {
                    yield this.refreshToken();
                    if (this._tokenSubject.value) {
                        return this._tokenSubject.value;
                    }
                }
                else {
                    return this._tokenSubject.value;
                }
            }
            throw new Error("Unable To Obtain Valid Token");
        });
 }

One more point: do you know what the effect might be of passing a buffer value (this defaults to 10 minutes if you don't pass anything in, which we never do) ?

@richardkshergold
Copy link
Author

Possibly linked to this #154

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant