Next Auth with React Native

81 Replies
Neto
Neto3y ago
you can look into a identity provider such as auth0 or clerk
Neto
Neto3y ago
Clerk
Clerk | Authentication and User Management
The easiest way to add authentication and user management to your application. Purpose-built for React, Next.js, Remix, and “The Modern Web”.
Neto
Neto3y ago
if you can dont roll your own auth service
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
Clerk
React Native - Expo Authentication | Clerk
Clerk is the best authentication and user management solution for React Native apps. Add sign up, sign in, and a user profile to your app in minutes.
Neto
Neto3y ago
aws cognito LOL
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
flutter theowat
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
fair
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
on the last jamstack conference there was a talk about clerk if you can find the vod may help you
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
no if you open ping site to sign in you only have social login as auth passwords are bad bad
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
not rolling your auth service is one thing not owning the user info is another oauth2 is amazing at that
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
next auth dont support rn
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
tbf it makes sense that next auth doesnt support rn a rn specific package to handle auth in the same way as next auth should be better
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
hot take auth is poohheh
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
that is a nice point for a auth service like auth0 and firebase its "Plug and play"
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
yep https://github.com/sTNeto1/t3-auth0 just did a basic implementation of auth0 with next and using trpc
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
https://github.com/STNeto1/t3-auth0/blob/main/src/server/trpc/router/example.ts#L15 ctx.session.user you have the user from there you go with what you want to do query or store something
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
i mean if you need to join the data with the user info
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
you have to shadow the auth0 db in the application db you can fetch manually from the service or you can create hooks to sync from auth0 to the application
Neto
Neto3y ago
Auth0 Docs
Post-User Registration
Learn how hooks can be used with the Post-User Registration extensibility point, which is available for database connections and passwordless connections.
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
you only shadow the real data you keep in sync with auth database but not manage it directly
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
if you want yes that way you can keep track of user stuff on the application
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
auth0 manage their identity authentication and authorization you keep a copy of the data for the sake of the content if you use next auth with prisma adapter you get a similar behaviour
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
i was just talking about the user data
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
dw
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
you can query their database of the tenant
inselbegabter
inselbegabter3y ago
hey guys. I'm having similar issues. after issuing the JWT I cannot query the database on a protected procedure. I was trying out auth0, firebase and https://github.com/t3-oss/create-t3-turbo Also, I was seeing that https://github.com/nextauthjs/next-auth/pull/5240 got abandoned. Has anybody some ideas? I am working and looking into solutions for days and can't get anything to work. IMO create-t3-app on mobile is currently kinda useless, if this issues persist.
GitHub
GitHub - t3-oss/create-t3-turbo: Clean and simple starter repo usin...
Clean and simple starter repo using the T3 Stack along with Expo React Native - GitHub - t3-oss/create-t3-turbo: Clean and simple starter repo using the T3 Stack along with Expo React Native
GitHub
feat: next-auth/expo by intagaming · Pull Request #5240 · nextaut...
☕️ Reasoning I attempted to create the next-auth/expo module that supports using NextAuth in Expo, with an external Next.js server acting as the NextAuth Authorization Server. The hope is that deve...
Neto
Neto3y ago
I mean Create t3 turbo is just a project starter C3a is a real product Next auth doesn't work on rn because it was made specially for next As the names implies next auth
inselbegabter
inselbegabter3y ago
I do not disagree 😄 I was hearing on Theo's stream, that mobile auth is coming and already worked on.
redbar0n
redbar0n3y ago
Theo - t3․gg
YouTube
We Fixed Mobile Dev
As a big fan of the T3 Stack, it's pretty dang cool we got it working on mobile. T3-TURBO-CLERK: https://github.com/clerkinc/t3-turbo-and-clerk James's YouTube: @James_Perkins http://youtube.com/@James_Perkins Create-t3-app: https://github.com/t3-oss/create-t3-app Create-t3-turbo: https://github.com/t3-oss/create-t3-turbo Julius's Twitter: ...
redbar0n
redbar0n3y ago
Clerk is good but many complain it's too expensive, though. https://Supertokens.com looks like a very attractive alternative: - easy (lots of enthusiastic reports about it) - use the managed solution (which is cheaper than the alternatives), - secure and scalable (rotating refresh tokens with JWTs), - open source, - has magic links, - and the architecture of it all allows you to simply and quickly eject to self-hosting it if/when you eventually need to.
SuperTokens, Open Source User Authentication
Add simple email and password sign up functionality to your site or app in 15 minutes
inselbegabter
inselbegabter3y ago
Adding Authentication and Authorization to create-t3-turbo (incl. E...
This is a guide on how to add authentication and authorization to a create-t3-turbo (incl. Expo) project using clerk.dev. The goal is to secure your app and ensure that only authorized users have access to certain features or resources. By using clerk.dev, you can easily add authentication and authorization to your create-t3-turbo app without ha...
inselbegabter
inselbegabter3y ago
ignore the sales pitch, since the repo in the video has everything this approach sets a JWT, which can be used with different providers thing is, that clerk provides a few components, which make life a little easier
Bennett
Bennett3y ago
With this announcement in mind (Clerk for auth), what are the plans for create-t3-turbo? Will create-t3-turbo be changed to always include clerk? Or should one use the new repo WITH clerk (https://github.com/clerkinc/t3-turbo-and-clerk) ? In other words: If you need auth, you should not use create-t3-turbo? Or are there future plans for create-t3-turbo to also include auth in some way?
GitHub
GitHub - clerkinc/t3-turbo-and-clerk: A t3 Turbo starter with Clerk...
A t3 Turbo starter with Clerk as the auth provider. - GitHub - clerkinc/t3-turbo-and-clerk: A t3 Turbo starter with Clerk as the auth provider.
inselbegabter
inselbegabter3y ago
as far as I know from what theo said on the stream, they are working on making next-auth compatible with react native. However, this was before https://github.com/nextauthjs/next-auth/pull/5240#issuecomment-1312543851 I believe this is the missing piece to fully self host authorization. Also see: https://github.com/t3-oss/create-t3-turbo/issues/33#issuecomment-1326447017
GitHub
feat: next-auth/expo by intagaming · Pull Request #5240 · nextaut...
☕️ Reasoning I attempted to create the next-auth/expo module that supports using NextAuth in Expo, with an external Next.js server acting as the NextAuth Authorization Server. The hope is that deve...
GitHub
What should I use instead of Next-Auth? · Issue #33 · t3-oss/create...
Excuse me, if this isn't actually an issue, but I just want to know the best way of authentication with this stack, because I love it.
inselbegabter
inselbegabter3y ago
For the time being, I think that the clerk stuff will stay seperate from the t3-turbo repo
redbar0n
redbar0n3y ago
i'm no official, but I bet that create-t3-turbo will remain the same, and t3-turbo-and-clerk is the clerk fork option for those that want clerk. Fortunately, since these are starter repos and not libraries, you only use them once, and don't need to pick the right one to depend on for future updates.
Amit
Amit3y ago
I was looking at similar solutions and found supertokens which can be selfhosted, but that would mean not using next auth i guess
Amit
Amit3y ago
SuperTokens, Open Source User Authentication
Add simple email and password sign up functionality to your site or app in 15 minutes
inselbegabter
inselbegabter3y ago
I honestly thing, that it is possible to use next-auth with react native. the implementation would nag me a bit, since OAuth is something I am not comfortable with (even as a senior :D) by following the ideas, the code that implements this (https://docs.expo.dev/guides/authentication/) and PR above, I can image that someone will get something working
Expo Documentation
Authentication
Expo is an open-source platform for making universal native apps for Android, iOS, and the web with JavaScript and React.
redbar0n
redbar0n3y ago
another alternative for crossplatform auth is Firebase Auth: https://github.com/Xiel7/create-t3-turbo-firebase
inselbegabter
inselbegabter3y ago
Can you use Supertokens OAuth with Expo?
redbar0n
redbar0n3y ago
yeah supertokens is crossplatform
inselbegabter
inselbegabter3y ago
I tried it in my current project. It apparently requires the react native firebase lib, which requires the programmer to mess with the xcode files. Since I have no idea about the xcode project files thingy I just stuck with clerk just felt more comfortable
Amit
Amit3y ago
I just found out supertokens today. It says you need to eject the app here if using expo https://supertokens.com/docs/react-native/installation
SuperTokens | Documentation
Add simple email and password sign up functionality to your site or app in 15 minutes
inselbegabter
inselbegabter3y ago
interesting. that means, that I'd have the same problem as with react native firebase 😄 But deffo worth checking out!
redbar0n
redbar0n3y ago
ok, that sucks 😕
inselbegabter
inselbegabter3y ago
I'd love to know how clerk has solved this issue
redbar0n
redbar0n3y ago
lmk if you find out!
inselbegabter
inselbegabter3y ago
https://github.com/clerkinc/javascript/tree/main/packages/expo They are using mostly a slightly adjusted react version for expo. I still have no idea on how it incorporates with the expo oauth flow.
GitHub
javascript/packages/expo at main · clerkinc/javascript
Official Javascript repository for Clerk authentication - javascript/packages/expo at main · clerkinc/javascript
redbar0n
redbar0n3y ago
I got a hold of supertokens support, and they said the docs were out of date and the issue mentioned there doesn't apply any longer. For RN/Expo they suggested following either of the guides instead. F.ex. for passwordless then go here https://supertokens.com/docs/passwordless/custom-ui/init/frontend and then Mobile then React Native tab.
SuperTokens, Open Source Authentication
Add simple email and password sign up functionality to your site or app in 15 minutes
Amit
Amit3y ago
That sounds great. I will have a look at their SDKs. I have been searching for a simple solution that requires the least amount of coding for auth/registration and works for both nextjs and react native. I have yet to find other options that can do this and can also be self-hosted.
redbar0n
redbar0n3y ago
let me know how it turns out! PS: I got a reply in supertokens discord immediately, so they should be quick to help if you run into issues.
Unknown User
Unknown UserOP3y ago
Message Not Public
Sign In & Join Server To View
inselbegabter
inselbegabter3y ago
this is marvelous! thanks for sharing it 🙂 I can't imagine it does.
redbar0n
redbar0n3y ago
only for crossplatform / mobile, since auth.js aka. nextauth doesn't support mobile/reactnative yet.
Wezter
Wezter3y ago
yeah only for cross platform / mobile I think at as well
James Perkins
James Perkins3y ago
well i think it’s for everything (but I am also biased towards Clerk). but in the case of T3 we are only here to help the community get what they want and for anyone who said Pricing is too high, love any feedback why you think our free tier doesn’t get you all the way to profitability and beyond before needed to upgrade to hobby plans. or what you think of hobby plans etc i’m all ears.
inselbegabter
inselbegabter3y ago
Hi @James Perkins ! It's nice to see someone from clerk to read our discussions. I honestly think that the pricing is fair, better/cheaper than other providers, and clerk's cost-effectiveness and ability to streamline the authentication process make it a valuable tool for developers looking to test and launch new applications, since I think that getting auth right is one of the hardest things to do. This is why I'm planning on using clerk for my coming applications. Currently I'm contracting with a law firm, who like to have everything self-hosted; and for organisations in Germany, e.g. Universities, are required to provide self-hosted solutions to nearly everything due to our version of the GDPR. Besides not paying an auth provider, owning/hosting the authentication system becomes a necessity for those kind of applications. It will be interesting to see if and how Clerk adapts to these requirements and continues to evolve in the future, but I'm already very happy with what clerk provides.
James Perkins
James Perkins3y ago
Hey this is great feedback! Honestly I work at Clerk but I am more about the community. I've been in this game a long time, and hanging in this Discord for a while. Theo and I have been doing some things behind the scenes before this video came around. He is the reason this ended up being a thing in the first place. I am going to funnel some of this back to the people with the power. Feel free at any point to hit me up for things related to Clerk, always happy to answer.
ironnator
ironnator3y ago
Have been using Clerk + t3-turbo for the last month! (Even before the t3-turbo-and-clerk repo came out). Lots of great stuff with this stack. Thanks for the quick updates and iterations!
James Perkins
James Perkins3y ago
this is great to hear. ❤️

Did you find this page helpful?