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

feat: Add support for custom refresh handling #715

Merged

Conversation

blumewas
Copy link
Contributor

@blumewas blumewas commented Mar 17, 2024

πŸ”— Linked issue

Issue #714

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

The current behaviour for refreshing the users tokens does not provide many options for me as developer. As a developer I would like to be able to extend or customize this behaviour.

This PR:

  • adds new types RefreshHandler and RefreshHandlerConfig
  • adds the possibility to configure a custom RefreshHandler via refreshHandler? property to auth.session
  • extracts the default refreshing behaviour to a separate file

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have added tests (if possible).
  • I have updated the documentation accordingly.

@zoey-kaiser zoey-kaiser added the enhancement An improvement that needs to be added label May 9, 2024
src/runtime/plugin.ts Outdated Show resolved Hide resolved
src/runtime/utils/refreshHandler.ts Outdated Show resolved Hide resolved
src/runtime/utils/refreshHandler.ts Outdated Show resolved Hide resolved
src/runtime/utils/refreshHandler.ts Outdated Show resolved Hide resolved
src/runtime/utils/refreshHandler.ts Outdated Show resolved Hide resolved
@zoey-kaiser
Copy link
Member

Hi @blumewas πŸ‘‹

Have you had a chance to look at the review yet? Otherwise are there any other open questions I can help you with?

@blumewas
Copy link
Contributor Author

Hi @zoey-kaiser,
I will try to put it on my agenda for today/this evening. The review got completely lost in all other PRs from work. Sorry for that.

@blumewas
Copy link
Contributor Author

Hey @zoey-kaiser,
I have implemented the requested changes made by @phoenix-ru. I have also merged the current main into my feature branch.

@zoey-kaiser
Copy link
Member

I have implemented the requested changes made by @phoenix-ru. I have also merged the current main into my feature branch.

Hi @blumewas πŸ‘‹

Thank you so much, sadly the lint is currently failing. However, its just an extra console statement and unneeded semi column. We can already begin on another review, but we will need to wait to merge until the linter passes 😊

@blumewas
Copy link
Contributor Author

Sorry my bad πŸ˜… I have now removed the console statement which made the linter fail

@phoenix-ru
Copy link
Collaborator

Thanks for the PR :)
I think it's good in its current state already.

I noticed that it's missing the website documentation, but I also checked SessionConfig here and it looks like this may also be a bit outdated (we have docs revamp planned anyway).

Would you be able to copy your options to the doc or should we do that ourselves?

@blumewas
Copy link
Contributor Author

I can do that later today. If you want to merge it already then it would be better if you will do it πŸ˜„

@zoey-kaiser zoey-kaiser merged commit 10b47ae into sidebase:main May 23, 2024
4 checks passed
@blumewas blumewas deleted the feat/custom-refresh-handler-support branch May 23, 2024 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement that needs to be added
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants