-
Notifications
You must be signed in to change notification settings - Fork 389
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
Would like a way to require auth without having Claims merged with my props #722
Comments
Hi @craig-pyrra - thanks for raising this Merging the user prop is expected behaviour and we don't have any plans to change this. For your use case, where you don't use the user from the SDK, I suggest you roll your own |
Thanks for the quick reply. Rolling my own
In this example I've attempted to return my own
The namespacing idea is my favourite, as it would also make me feel comfortable about letting the |
Describe the problem you'd like to have solved
The
withPageAuthRequired
helper merges auser
property into the output of thegetServerSideProps
function that is passed into it. But in my case I don't want those props available to the page. I am retrieving the session and looking up the matching user from my own database, and passing just the exact set of props needed for the page. Generally I don't think it's a good idea to modify the output ofgetServerSideProps
- it makes it harder to reason about exactly what props the page is getting.For example
Describe the ideal solution
It could be as simple as an additional option to
withPageAuthRequired
:I actually think merging props should be disabled by default, based on the principle of least surprise.
Alternatives and current work-arounds
I don't have a good workaround at the moment, but probably I could wrap
withPageAuthRequired
and try to strip out the extra props, except it might be tricky, given the type ofClaims
?The text was updated successfully, but these errors were encountered: