-
Notifications
You must be signed in to change notification settings - Fork 267
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
When calling signOut() revokeAccessToken() seems not be called. #393
Comments
@Taras-R By checking the code in v3.1.2, looks like it behaves as expected. |
@shuowu thak you for your respond. |
@Taras-R - Your code sample calling signOut is async, but NOT awaiting the result of signOut, so your logout method completes before the internals of signOut have ever run. If another step running after your logout() modifies token storage or other interactions, the code may be unable to effectively revoke the token when it finally goes to do so. I suggest:
Let us know if that helps at all. |
@swiftone thank you for your response! We tried the solution you propose and it still works the same. Token is revoked only when we manually use revokeAccessToken(). |
internal ref: OKTA-308847 |
We are currently experiencing the same issue. Have used both the samples provided in this thread:
and also
Neither work in revoking the token after signout. This is a huge issue for us as it is a security threat. |
@staffordp revoke should be handled by providing a boolean option for the signOut method to trigger the revoke behavior.
Also, for the first code snippet, okta-auth-js will only look for Please see detailed information in revokeAccessToken API |
After updating to the following version,
I tried this snippet after but it did not work. Do you believe the tokenManager.clear() could have caused an issue?
Also, I am not sure why the revokeAccessToken needs to be explicit. The docs on the site say: signOut() |
@staffordp You are right, it does not need to be set explicitly. Sorry, I miss read the code. Based on the report, looks like there is an issue with revoking the token (I suspect the storage key you use in code may be different with the default storage key, which is
|
We are using the following code:
I've tried with both the revokeAcessToken: true and without. Neither work. I am still able to view client info with that same accessToken after this code runs. At this point, I am at a loss as to what to do. |
@staffordp here is piece of code we use and it revokes token manually. The only difference i can tell is that we do not get token with our service but use Okta method (if you saved token in token manager with key 'accessToken' there is no need to get it). So i think you just don't use Okta token manager to save token, but your own service. And i think revokeAccessToken can receive token object, not just raw JWT (documentation still is not very clear about it, it is just telling to provide this token if it was saved in different place and nothing about format).
Here is an example in documentation where they get the token to renew it: https://www.npmjs.com/package/@okta/okta-auth-js?activeTab=readme#tokenrenewtokentorenew (it is an object received from Okta, not just string). Hope that helps, try to save token using token manager and it should work.
and this
I still don't understand why it does not work from the box as it is described in documentation, especially when lot of users even have no idea that after using signOut their token is not revoked. After this code runs user info is not accessible anymore. |
If I need to pass the accessToken object, or I need to populate it in the tokenManager, what format should it be in? We have a situation where the user uses an Angular app just to handle the login and Okta token retrieval. It stores the values of the idToken and accessToken (the value string), and full accessToken object in different cookies and redirects to another Angular app where these cookies are used for calls.. On logout, the user is redirected to the Login app's logout component where it attempts to sign the user out. I am assuming this tokenManager is cleared between these app loads. So, if this is the case and I am unable to retrieve that token via tokenManager at first, how can I either repopulate it into the tokenManager in a format that it is friendly to it (via a cookie) or convert it and pass it directly into the revokeAccessToken() call? Edit: Also, I was not able to successfully attempt to revoke the token seeing how the call always redirected me to the 400 Okta Page citing a non-white listed redirect URI when in fact I was passing in one that was. Even when omitting the postLogoutRedirectUri, I still am redirected to the 400 page with the latest 3.14 version. I tried making a few API calls after to see if the accessToken had been revoked even though experiencing the 400 page, but found I was still able to successfully make POST calls with that same accessToken. |
If you have all token object saved, i think it should work, token manager just saves it and allows to access it quickly. Just try raw JWT and also try object returned with Okta, i didn't analyze source code so i'm not sure which one is correct. In every angular app you must create new OktaAuth() to access all methods in any of them (signOut and revokeAccessToken). Applications should share same domain, so cookies can be shared too. Link you use to redirect after logout must be provided in logout redirect uri's list in settings of your Okta application. If it is not provided, Okta will show you error page that url is not whitelisted. |
I tested out again this morning without even moving between different apps by running it local. I am still unable to revoke the token (after this code executes, I am still able to make API calls using that same accessToken value). Additionally, on sign out, I keep getting redirected to the followiing page (attached), even though the domain(s) I have tried are all whitelisted in the Okta app for Login redirect URIs. Here is the code I am using below: in the constructor for the Okta client creation:
SignOut:
I don't understand why it is NOT revoking the token even though I am running 3.14 and I am following all documentation and suggestions. Further, if the URI is whitelisted, WHY does it keep giving me this error? |
@staffordp i'm not Okta developer, and i would answer if i wrote this code:) i'm just the one who started this conversation. I agree it MUST work, but it is not. My solution with revoking manually works fine as i can tell. In your config i see difference with ours: postLogoutRedirectUri, not just redirectUri |
Would you mind sharing your oktaConfig? Perhaps with the upgrade from 2.9, some of the options we are specifying in the config are old and causing this issue? |
it's pretty much default
|
Thanks for sharing. I thought perhaps you had a config item I was missing that may have led to my problem but it doesn't seem so. |
@staffordp - We've noticed issues where the browser might append/remove a trailing / on the url compared to the value stored in Okta. If you have a redirect_uri that you think should be working, try adding versions both with and without a trailing slash to see if that clears anything up. We're testing different browsers to see if we can get the exact symptoms down. I'm not sure if this is related to your issue or not, but worth checking. |
Thanks for the reply. I had originally read the documents wrong and didnt realize there was a section for Logout Redirect URIs which we did not have populated. Once we added the URIs there, the issue with redirecting to the Okta page went away. |
@swiftone Was also able to validate via Okta support that the token is being revoked properly. The issue is with our API library not checking for revocation. |
@Taras-R - We've identified a bug in the signOut method that will break revoke. Fix incoming soon. Internal ref: OKTA-315806 |
I was going through the same problem. I observed that within the
The work around for me was to provide the accessToken in the options: await this._oktaAuth.signOut({
revokeAccessToken: true,
idToken,
accessToken
}); |
Hi Okta team, we have faced with an issue and would like to describe it here. Maybe we do not understand something clear enough, so hope you can clarify a bit.
We are using latest 3.1.2 okta-auth-js
The official documentation says about signOut() method:
After we use signOut() we are still able to receive user data for example using this route
${baseUrl}/v1/userinfo
and token that was valid before signOut().But when we use revokeAccessToken() inside logout() implicitly it works and userinfo is no longer accessible using accessToken.
Can you please advice if we are doing something wrong or calling signOut() does not call revokeAccessToken() by design? Thank you.
The text was updated successfully, but these errors were encountered: