Is it possible to auth both nextjs and mobile app (android/iOS)?

Suppose I have a nextjs application using better auth which use cookie session, and I also have an android/iOS app which want to use token session, the web app and mobile app share same nextjs server. is it possible to do that? If it can be achieved, can OAuth also be achieved?
3 Replies
bekacru
bekacru5mo ago
are you using expo/react-native or native?
wnbot
wnbotOP5mo ago
it's native app. in my opinion, if use email sign in, the mobile app sends the email and password or otp-code to better-auth, and then receives a bearer token to access authorized resources. if use oauth, like sign in with google, the app sends a idToken which got from local google-auth-sdk to better-auth, then better-auth should verify the idToken then generate a bearer token to mobile app. I found this documentation to verify the idToken : https://developers.google.com/identity/sign-in/ios/backend-auth#node.js .by the way, the web app of nextjs, still use cookie to auth use. I'm new to node, I'm not sure if what I said is accurate, please correct me if I'm wrong. and sorry for my bad English.
Sizoune
Sizoune2mo ago
hi, is there any update for this problem ?

Did you find this page helpful?