create-t3-turbo icon indicating copy to clipboard operation
create-t3-turbo copied to clipboard

What should I use instead of Next-Auth?

Open LansPeti opened this issue 3 years ago • 1 comments
trafficstars

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.

LansPeti avatar Oct 12 '22 18:10 LansPeti

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

Maybe try auth0 or something like that?

juliusmarminge avatar Oct 14 '22 07:10 juliusmarminge

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

alexnault avatar Nov 04 '22 02:11 alexnault

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.

AshSimmonds avatar Nov 04 '22 02:11 AshSimmonds

@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

valerius21 avatar Nov 14 '22 01:11 valerius21

@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.

juliusmarminge avatar Nov 14 '22 01:11 juliusmarminge

@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.

valerius21 avatar Nov 14 '22 09:11 valerius21

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.

jayp97 avatar Nov 23 '22 22:11 jayp97

@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 avatar Nov 24 '22 13:11 valerius21

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

valerius21 avatar Nov 24 '22 17:11 valerius21

@valerius21 color me interested!

GringoDotDev avatar Nov 30 '22 16:11 GringoDotDev

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

valerius21 avatar Dec 03 '22 10:12 valerius21

@valerius21 Yes please!

JClackett avatar Dec 03 '22 14:12 JClackett

@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

valerius21 avatar Dec 05 '22 01:12 valerius21

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.

ebg1223 avatar Dec 07 '22 23:12 ebg1223

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?

Sn0wye avatar Dec 15 '22 19:12 Sn0wye

@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.

ebg1223 avatar Dec 15 '22 20:12 ebg1223

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

Sn0wye avatar Dec 15 '22 20:12 Sn0wye

@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.

ebg1223 avatar Dec 15 '22 20:12 ebg1223

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

Sn0wye avatar Dec 15 '22 20:12 Sn0wye

Hey @ebg1223 where should I put the callback url?

Sn0wye avatar Dec 16 '22 10:12 Sn0wye

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

jokull avatar Dec 21 '22 17:12 jokull

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

GringoDotDev avatar Dec 21 '22 17:12 GringoDotDev

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:

  • Protected routes implemented at Expo
  • OAuth for Discord
  • User Management in the next.js app
  • Context and middleware for TRPC

Coming soon:

  • Sign-in page for Expo (email, password)
  • A full how everything works a guide for people unfamiliar with Clerk and how everything is implemented.

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

perkinsjr avatar Dec 22 '22 20:12 perkinsjr

@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

paulclark avatar Dec 28 '22 01:12 paulclark

@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.

perkinsjr avatar Dec 28 '22 01:12 perkinsjr

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.

juliusmarminge avatar Dec 29 '22 21:12 juliusmarminge