I’d like to build a NextJS app that uses Realm for user authentication with protected API routes for user data. Does anyone have a link to an tutorial article, or Github Repo or any other resources to do this?
Depending on your approach to authentication, you’d either use the Realm Web SDK or the Node.js SDK. But when it comes to Auth, are you trying to use Realm solely for auth or do you need other realm features in your app. The only reason I ask is that if you just need user authentication, a specific library like Next-Auth could be a better choice.
I’m planning to build a Admin/Dashboard app for authenticated users only. Non-authenticated users will only see a logon screen.
I would love to use NextAuth if it supports Realm features. Other developers in my company are working with Realm for other, non-Next JS apps, so I think I need to find a way to tie into Realm for authentication.
Hey Brian - not sure what your implementation details are for auth in the other apps, but it seems like NextAuth would work with Realm if you use JWT Authentication. After using NextAuth to sign in, you can pass in the JWT that you get from the callback to Realm’s JWT Auth provider
In a real application, you would want to have a more complex authentication flow. For more information, refer to the Next.js authentication documentation.
Could anyone share of an example using Next Auth and Realm Web?