-
-
Notifications
You must be signed in to change notification settings - Fork 930
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
Add openidconnect authentication demo #1500
Conversation
Most of the tests fail because the required env variables are not set, the ones that are needed are in the readme. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks amazing! Auth examples are some of the most complex (but very useful) examples we need for Dioxus, thanks for putting this together! There are a few places in the code that could cause issues in the future or could be simplified.
Most of the tests fail because the required env variables are not set, the ones that are needed are in the readme.
Could you exclude/skip the test in the CI workflows?
Thanks for the feedback, I'll have a look at it when I can! |
You are welcome, I also needed it for myself and my company, so it's also good for me to get a code review from someone who knows dioxus :). I also rewrote some of the parts to try to make it simpler/reflect the authentication flow better, so I'm open to feedback to make it simpler.
I didn't need to exclude the example from the CI workflow in the end. Also, I'm still getting this warning when running |
I think that is an artifact from wasm-bindgen that we currently don't strip. It is safe to ignore for now. |
That sounds like a good idea. There is a lot of duplicate pattern matching between components. You could try to use borrowed props but you might run into some issues with temporary lifetimes since you would be borrowing from a Ref. If you can't borrow the state, you could clone it before passing it as props. It seems like the objects are relatively small so it shouldn't effect performance too much. (and you save some work matching in child components) |
You can implement PartialEq manually (without the |
Oh good idea, I think I prefer this solution, cloning the |
How would I pass the Edit: Maybe the best way would be to keep using fermi for the components that are direct children to the header and use props for the descendents of these children |
You need to either use the context API or Fermi. You can use the context API or Fermi to get the router within each route you need it in and then use props to pass it to the children of the route once you get the state you need out of the client |
That's what I thought, thanks! I guess this PR is up for review then. If you see anything else that should be corrected I'm open for feedback, otherwise I think It's good enough to be merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
This is a follow up on #1152, this example shows how to implement authentication using OpenID connect.
I am not an expert on openid/dioxus so I'll require a thorough review if possible!
I also feel like we need a dioxus-auth module for openid/oauth2 to make it easier for anyone to use it, I'm open to help implement it if we have an idea on what the API should look like.
Edit: Happy 1500th pull request!