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

Inconsistency: identity.clearAllCachedAuthTokens API availability #648

Closed
twschiller opened this issue Jun 27, 2024 · 7 comments
Closed
Labels
neutral: safari Not opposed or supportive from Safari

Comments

@twschiller
Copy link

twschiller commented Jun 27, 2024

Description

  • The identity.clearAllCachedAuthTokens endpoint is inconsistently supported across browsers. It looks like it might only be only available on Chrome?
  • What's the intended behavior of the method? Is it only for use in clearing the Google-specific token in Chrome?
  • It'd be good to get it added to MDN compatibility matrix, and for the MS Edge team to chime in on support

Documentation

Related Discussions

@twschiller twschiller changed the title Inconsistency: identity.clearAllCachedAuthTokens availability Inconsistency: identity.clearAllCachedAuthTokens API availability Jun 27, 2024
@github-actions github-actions bot added needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time needs-triage: safari Safari needs to assess this issue for the first time labels Jun 27, 2024
@xeenon xeenon added neutral: safari Not opposed or supportive from Safari and removed needs-triage: safari Safari needs to assess this issue for the first time labels Jun 29, 2024
@mukul-p
Copy link
Collaborator

mukul-p commented Jul 4, 2024

Edge is not supporting this API. I'll work with internal teams to get the document updated.
Call to this API in Edge should give an error message.

@Rob--W Rob--W removed needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time labels Jul 4, 2024
@Rob--W
Copy link
Member

Rob--W commented Jul 4, 2024

This is a Google/Chrome-only API.

There was a recent feature request for a similar API (identity.removeCachedAuthToken) in Firefox that I closed with an explanation. For more context, see https://bugzilla.mozilla.org/show_bug.cgi?id=1888889#c2

@Rob--W Rob--W closed this as completed Jul 4, 2024
@twschiller
Copy link
Author

twschiller commented Jul 5, 2024

@mukul-p @Rob--W To clarify, clearAllCachedAuthTokens and removeCachedAuthToken are only for use with the Google OAuth2 token obtained using getAuthToken (and are therefore only supported on Google Chrome)?

They're not for use with launchWebAuthFlow, which has cross-browser support? Is there any information/specification on what caching (if any) is performed with launchWebAuthFlow?

@Rob--W
Copy link
Member

Rob--W commented Jul 8, 2024

@mukul-p @Rob--W To clarify, clearAllCachedAuthTokens and removeCachedAuthToken are only for use with the Google OAuth2 token obtained using getAuthToken (and are therefore only supported on Google Chrome)?

Yes. Note that this only removes the token from the cache, it does not revoke it. If you want to revoke the token, an answer is available at https://stackoverflow.com/questions/17337107/google-packaged-app-identity-api-removecachedauthtoken. From the answer it is also apparent that the token is tied to Google's API.

They're not for use with launchWebAuthFlow, which has cross-browser support?

Indeed.

Is there any information/specification on what caching (if any) is performed with launchWebAuthFlow?

The regular browser cache is used. This is not explicitly documented. Documentation is at https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/identity/launchWebAuthFlow and https://developer.chrome.com/docs/extensions/reference/api/identity#method-launchWebAuthFlow

@twschiller
Copy link
Author

twschiller commented Jul 9, 2024

Thanks for the clarification!

From the answer it is also apparent that the token is tied to Google's API.

It'd be great if the Chrome team updated their documentation to clarify. In particular, clearAllCachedAuthTokens mentions "De-authorizes the user from all auth flows" which shares the "auth flow" terminology of web auth flow

Does the Chrome team have a way to suggest changes? (I just see an "Is it helpful" voting button)

The regular browser cache is used.

Does that suggest we'd need to request cookies and clear out anything that might be related to client-side caching for launchWebAuthFlow? Or what would be getting cached for an OAuth2 PKCE flow?

@Rob--W
Copy link
Member

Rob--W commented Jul 9, 2024

Thanks for the clarification!

From the answer it is also apparent that the token is tied to Google's API.

It'd be great if the Chrome team updated their documentation to clarify. In particular, clearAllCachedAuthTokens mentions "De-authorizes the user from all auth flows" which shares the "auth flow" terminology of web auth flow

Does the Chrome team have a way to suggest changes? (I just see an "Is it helpful" voting button)

@oliverdunk ^

The regular browser cache is used.

Does that suggest we'd need to request cookies and clear out anything that might be related to client-side caching for launchWebAuthFlow? Or what would be getting cached for an OAuth2 PKCE flow?

This is dependent on the OAuth provider. From the OAuth2 perspective, only the output (token) matters. Any potential side effects from the intermediate steps to get there are site-specific. E.g. the user could logs in to some site, or even already be logged in. Unconditionally clearing cookie state is not really useful. I cannot offer more concrete advice here.

@oliverdunk
Copy link
Member

Does the Chrome team have a way to suggest changes? (I just see an "Is it helpful" voting button)

Hi @twschiller, you can use the "File a bug" link in the footer which goes here: https://issuetracker.google.com/issues/new?component=1400036&template=1897236

Please do file this, it seems like a good thing to clarify :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
neutral: safari Not opposed or supportive from Safari
Projects
None yet
Development

No branches or pull requests

5 participants