t3-oss / create-t3-turbo

Clean and simple starter repo using the T3 Stack along with Expo React Native
https://turbo.t3.gg
MIT License
4.59k stars 388 forks source link

What should I use instead of Next-Auth? #33

Closed LansPeti closed 1 year ago

LansPeti commented 1 year ago

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.

juliusmarminge commented 1 year ago

You need to make your own solution since nextauth doesnt work on native yet.

Maybe try auth0 or something like that?

alexnault commented 1 year ago

@LansPeti next-auth is coming to create-t3-turbo! https://github.com/t3-oss/create-t3-turbo/pull/36

AshSimmonds commented 1 year ago

I use Auth0 - tried half a dozen other ways and they were all much more convoluted and fragile.

Actually, here's the release notes from a couple months ago once I got it sorted:

After some harrowing times trying to get Supabase and NextAuth and that Iron one and a few other options trying to work, I was pulling my hair out cos NextJS/React/Supabase are right now in flux between major version stuff, and so getting all the pieces working together just kept failing.

Out of the blue I got an email from Auth0 mob who I haven't thought about for years. I think back in 2018 I had to implement auth but Auth0 was utterly awful to deal with getting working on AngularJS, and the boss hated the interstitial going away from the site for logging, and not "owning" the user data, and that it might eventually cost money, and various other things so I'd forgotten.

Anyhoo tried it for shits n giggles simply because I'd just wasted 2 days undoing a whole auth system that almost worked, but failed at crucial things and was still janky as hell, especially with React and it's useState() nightmares. Well, took less than 15mins to get Auth0 working, and it's really easy to get the data directly on the page to deal with straight away.

WHY IS AUTH STILL SO DIFFICULT? Ugh, I never want to deal with login stuff again, it sucks all the fun out of creating cool stuff.

Guess we'll never really trust each other.

valerius21 commented 1 year ago

@juliusmarminge is the template currently working with expo now? I can't really tell from the merge messages and it's not working in my app either 😄

Also, I was seeing this PR draft and it seems to be inactive for the time being https://github.com/nextauthjs/next-auth/pull/5240

juliusmarminge commented 1 year ago

@juliusmarminge is the template currently working with expo now? I can't really tell from the merge messages and it's not working in my app either 😄

Also, I was seeing this PR draft and it seems to be inactive for the time being https://github.com/nextauthjs/next-auth/pull/5240

Says in readme auth package doesn't work with expo just yet.

valerius21 commented 1 year ago

@juliusmarminge is the template currently working with expo now? I can't really tell from the merge messages and it's not working in my app either 😄 Also, I was seeing this PR draft and it seems to be inactive for the time being nextauthjs/next-auth#5240

Says in readme auth package doesn't work with expo just yet.

Oh Sorry! I overlooked it. 😂 Thank you for your reply and work on this repository. It's insanely well done.

jayp97 commented 1 year ago

Has any more work been done on creating a solution to get next-auth working with expo? Once this is solved this will be an absolute game changer for cross platform development.

valerius21 commented 1 year ago

@jayp97 https://github.com/nextauthjs/next-auth/pull/5240#issuecomment-1312543851 it seems to be abandoned for expo at the moment. I am trying to get clerk.dev working as a temporary solution. The last problem I am currently facing is making authenticated tRPC calls from react native. They also have documentation on implementing their auth-provider service with tRPC

valerius21 commented 1 year ago

I have worked up a solution with RN and tRPC capable of authentication and authed-tRP-requests. If there is any interest, HMU.

GringoDotDev commented 1 year ago

@valerius21 color me interested!

valerius21 commented 1 year ago

@jseitel I'll write something up after the weekend and link it :)

JClackett commented 1 year ago

@valerius21 Yes please!

valerius21 commented 1 year ago

@jayp97 nextauthjs/next-auth#5240 (comment) it seems to be abandoned for expo at the moment. I am trying to get clerk.dev working as a temporary solution. The last problem I am currently facing is making authenticated tRPC calls from react native. They also have documentation on implementing their auth-provider service with tRPC

and

I have worked up a solution with RN and tRPC capable of authentication and authed-tRP-requests. If there is any interest, HMU.

Took the time to write something up. I still think that using next-auth and supabase for example should be possible, even though it's not mentioned in the article. Maybe this leads to something :)

https://www.valerius.me/posts/adding-authentication-and-authorization-to-create-t3-turbo-incl-expo-with-clerkdev

@JClackett @jseitel

ebg1223 commented 1 year ago

If anyone is still looking for a solution, i've had this setup for a bit, just packaged it up to share:

https://github.com/ebg1223/create-t3-turbolito

clerk.dev auth, along with solito and expo router.

Sn0wye commented 1 year ago

If anyone is still looking for a solution, i've had this setup for a bit, just packaged it up to share:

https://github.com/ebg1223/create-t3-turbolito

clerk.dev auth, along with solito and expo router.

working fine?

ebg1223 commented 1 year ago

@Sn0wye working well for me! I am using this setup in production. I created this repo by moving over the code from a functional app, but as that app continues development, I am trying to keep the repo consistent but may fall behind. If you run into issues, let me know, I may have the solution and just forgot to move it to the template repo.

Sn0wye commented 1 year ago

I'm analyzing which one works the best for me between Auth0 and clerk.dev, and clerk.dev is looking the best for now.

ebg1223 commented 1 year ago

@Sn0wye I switched over from auth0. Too many weird dependency issues and legacy stuff. Clerk.dev is definitely new, not perfect, but they are extremely responsive to issues, and are actively contributing to the community to make auth in the react ecosystem as easy as possible. They are sponsoring Auth.js(formerly nextjs), which could end up being a viable alternative when they launch react native support, if you want to host your own.

Sn0wye commented 1 year ago

Yep, probably going with clerk.dev, that'll be a lot of work anyways

Sn0wye commented 1 year ago

Hey @ebg1223 where should I put the callback url?

jokull commented 1 year ago

If you want email/password I have cooked something up that uses Cloudflare Workers + D1 and bcrypt to hash passwords. - email me on jokull@solberg.is if you're interested.

GringoDotDev commented 1 year ago

out of curiosity, has anyone tried setting up passport.js and exposing it through api route(s)? from what I remember of the architecture it should work on both web and mobile

perkinsjr commented 1 year ago

Hi there!

James from Clerk.dev here. We heard through some channels that you were looking for alternatives, so we created a Clerk template. It's open source and uses best practices with Clerk, TRPC, etc. Very easy to extend and use as needed and works the same as the original t3-turbo.

Things we added:

Coming soon:

You can check it out here: https://github.com/clerkinc/t3-turbo-and-clerk

paulclark commented 1 year ago

@perkinsjr thanks for offering a solution! I tried a fresh clone of your repo + a fresh clerk.dev account, copied API keys into .env + _app.tsx, and enabled Discord in the dashboard, and am getting the following error plus a console warning:

@acme/expo:dev: LOG error signing in Something went wrong during the Sign in OAuth flow. Please ensure that all sign in requirements are met.

Console warning is:

WARN Linking requires a build-time setting scheme in the project's Expo config (app.config.js or app.json) for production apps, if it's left blank, your app may crash. The scheme does not apply to development in the Expo client but you should add it as soon as you start working with Linking to avoid creating a broken build. Learn more: https://docs.expo.dev/guides/linking/

Screenshots below:

Screenshot 2022-12-27 at 5 35 49 PM

simulator_screenshot_A5CD87F7-590E-47A9-99E9-02DE46D2F719

perkinsjr commented 1 year ago

@perkinsjr thanks for offering a solution! I tried a fresh clone of your repo + a fresh clerk.dev account, copied API keys into .env + _app.tsx, and enabled Discord in the dashboard, and am getting the following error plus a console warning:

@acme/expo:dev: LOG error signing in Something went wrong during the Sign in OAuth flow. Please ensure that all sign in requirements are met.

Console warning is:

WARN Linking requires a build-time setting scheme in the project's Expo config (app.config.js or app.json) for production apps, if it's left blank, your app may crash. The scheme does not apply to development in the Expo client but you should add it as soon as you start working with Linking to avoid creating a broken build. Learn more: https://docs.expo.dev/guides/linking/

Screenshots below:

Screenshot 2022-12-27 at 5 35 49 PM

simulator_screenshot_A5CD87F7-590E-47A9-99E9-02DE46D2F719

Did you try and sign in before Sign up?

This error usually occurs if the user doesn't exist in the database.

Please open an issue in our repo if this happens when using sign up and I can track down the issue.

The log is there because we don't want to set the production pieces for a template.

juliusmarminge commented 1 year ago

Thanks @perkinsjr for making an official integration repository. I'll close this issue now and added a link to your integration in the root readme.