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

Remove secureroute component and react-router dependency #214

Merged
merged 3 commits into from
Jun 28, 2024

Conversation

pavinduLakshan
Copy link
Contributor

@pavinduLakshan pavinduLakshan commented Feb 21, 2024

Purpose

SecureRouter component in React SDK allows defining protected routes in a React app, when the used routing library is the React Router[1], but it isn't without its own complexities and tech debt introduced to the SDK.

  1. Securing routes is out of scope of an authentication SDK. It's up to the application to secure its routes, using the functions provided by the SDK (such as isAuthenticated)
  2. Introducing SecureRoute has resulted in a tightly coupled integration with the React Router library.
  3. SecureRoute is based on the custom routes feature in React Router v5, which is no longer available in v6 and onwards. [2] Therefore, applications using a React router version higher than v6 are unable to use the SecureRoute component.

Due to the above reasons, we are planning to remove SecureRoute component from the React SDK. Instead, we are adding example code snippets to the API documentation for securing app routes using several prominent routing libraries.

Related Issues

[1] https://reactrouter.com/en/main
[2] https://gist.github.com/mjackson/d54b40a094277b7afdd6b81f51a0393f

@pavinduLakshan
Copy link
Contributor Author

pavinduLakshan commented Feb 21, 2024

Marked as draft until the documentation work and internal discussions are concluded.

@pavinduLakshan pavinduLakshan marked this pull request as ready for review June 27, 2024 09:33
@brionmario brionmario merged commit 177e88c into asgardeo:main Jun 28, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

Bring your own router: Remove react-router-dom dependency React Router version defined is too harsh
2 participants