Search code examples
next.jsnext-auth

Integrating Next-Auth with React Native for Mobile Authentication


I have a website that uses next-auth. I'd like to write a React Native application and connect authentication so that users can log in from the mobile app. Is this even possible, and if so, how can I do it?

i tried in some way, but next-auth is too secure for my ideas.


Solution

  • OAuth 2 works with an API, so you have to connect users with your server, authorize and then make secure JWT for it and save it in AsyncStorage.

    This is complex process if you want to make custom auth from your app to website, so my offer is redirecting user from your app to your website and do your auth there, after that pass JWT to app with API.

    Second way is to use this lib in your app and match email that signed in from your app with emails that is in your server. https://docs.expo.dev/guides/google-authentication/