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

Recommended way to use with React server actions #1710

Open
5 tasks done
nimeshnayaju opened this issue Mar 21, 2024 · 0 comments
Open
5 tasks done

Recommended way to use with React server actions #1710

nimeshnayaju opened this issue Mar 21, 2024 · 0 comments

Comments

@nimeshnayaju
Copy link

nimeshnayaju commented Mar 21, 2024

Checklist

  • I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

Hi, thanks for all the work on v3 and making the library compatible with the Next.js App Router. I am mostly curious about the recommended way to use the library with react server actions. I noticed in the withApiAuthRequired method, there are some cookie related logic (setting cookies, etc) and was wondering about the best practice when using the library with server actions.

Describe the ideal solution

I do not have an ideal solution in mind, but here are some potential solutions (one I can think of):

  1. A "higher order" server action that accepts a server action and and returns a server action after performing authentication related logic.
  2. Expose necessary primitives with detailed code snippets on how to use them with server actions. Could be extended to API routes too.
  3. If no new feature needed, examples on how to deal with authentication inside server actions.
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

No branches or pull requests

1 participant