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

React v2.1.1 #88

Merged
merged 4 commits into from
May 8, 2024
Merged

React v2.1.1 #88

merged 4 commits into from
May 8, 2024

Conversation

JakeLo123
Copy link
Collaborator

@JakeLo123 JakeLo123 commented May 8, 2024

What is this PR and why do we need it?

This is to handle #82. This also Adds onAutoRefreshFailure callback as a config option to react via the core package. (Let's add this to Vue ASAP to help #13 and resolve this same issue, which is likely occurring there).

Testing
To make this easier/faster, I would log into FA admin dashboard and set the JWT expiration time to 60 seconds and test from there. Your refresh call should happen after 50 seconds.

Testing the success case

  • Log in and await the refresh call. You should remain logged in longer than 1 minute.

Testing the failure case
You can create a refresh failure by configuring the SDK like so:

{
  shouldAutoRefresh: true,
  tokenRefreshPath: "/app/something-fake",
  onAutoRefreshFailure: (e) => console.error("Refresh failure!", e),
}

You should be automatically logged out 10 seconds after the refresh failure.

Other Changes

  • Bump react SDK version to v2.1.1 and regenerate docs
  • Add yalc scripts to publish/push react sdk to package json
  • Remove CookieHelpers class wrapper because it’s not needed.
  • Remove CookieHelpers, UrlHelper, and TokenRefresher classes from package public API.
  • Add onAutoRefreshFailure to SDKConfig
  • Remove TokenExpirationScheduler and TokenRefresher and re-implement via the core
    • I’m starting to feel that these abstractions they make the core class slightly harder to understand rather than the opposite. I think that un-abstracting them is a good decision.

Pre-Merge Checklist (if applicable)

  • Unit and Feature tests have been added/updated for logic changes, or there is a justifiable reason for not doing so.

@JakeLo123 JakeLo123 added bug Something isn't working enhancement New feature or request React SDK Core relating to the framework-agnostic core of the SDKs labels May 8, 2024
@JakeLo123 JakeLo123 self-assigned this May 8, 2024
@JakeLo123 JakeLo123 changed the title [React] bugfix -- isLogged set false after tokenrefresh [React 2.1.1] bugfix -- isLogged set false after tokenrefresh May 8, 2024
This was referenced May 8, 2024
@JakeLo123 JakeLo123 changed the title [React 2.1.1] bugfix -- isLogged set false after tokenrefresh React v2.1.1 May 8, 2024
@JakeLo123 JakeLo123 merged commit 064d229 into main May 8, 2024
3 checks passed
@JakeLo123 JakeLo123 deleted the post-refresh-handling branch May 9, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request React SDK Core relating to the framework-agnostic core of the SDKs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants