Open marssarthak opened 6 months ago
@TanmayDhobale Bro I see you wrote the auth code, Can you please suggest how can I extend it to integrate in mobile app?
did you guys not get this error
No. I didn't run it locally, used harkirat's deployed links for now.
@marssarthak you can switch to a JWT (JSON Web Token) based authentication system. JWTs are self-contained tokens that can be easily passed between the client and server, making them a good fit for mobile applications like React Native.
@marssarthak can i work on this ?
@TanmayDhobale Yes It would be great help.
I suggest this approach- I will make google base login system in react native using official SDK, and then I'll send the object returned from google signin to backend. Then backend should handle that user and send a JWT in return. Please correct me if wrong.
@marssarthak sounds good !!
@marssarthak @hkirat Here's how we can proceed with this :
React Native Frontend: Integrate the Google Sign-In SDK for React Native in our frontend codebase. Implement a screen or component that handles the Google Sign-In flow and retrieves the user's information (e.g., email, name) from the Google Sign-In SDK. Once the user successfully signs in with Google, send the retrieved user information to our backend for authentication and account creation/linking.
Backend: Implement a route (e.g., /auth/google) that accepts the user information from the React Native frontend. Verify the user information and create a new user account or link the existing account with the provided Google credentials. Generate and return a JWT (JSON Web Token) to the frontend upon successful authentication. and again in frontend Receive the JWT from the backend and securely store it (using AsyncStorage or react-native-keychain) for subsequent API requests. Implement a utility function or service to attach the JWT to the Authorization header or request body for protected API routes. Please let me know if you have any further suggestions
Sounds great to me, I have a confusion, whether existing session based login will work on web, or should we migrate to JWT there also?
@marssarthak i think For easier maintenance, it would be better to migrate the web application to a JWT-based authentication system as well. This way, both the React Native mobile app and the web application will share the same authentication mechanism and backend codebase.
Hello @TanmayDhobale , any update on this task? Please ping me once when done.
Give me 15 min @marssarthak
@marssarthak can u check the pull request #160
@TanmayDhobale Awesome work bro. I need some help in this backend, can I connect with you on discord?
yes @marssarthak give ur id ill text u
here- ***
done
Hi. I am working on react native implementation. The frontend is ready, but I am unable to use the existing backend because of session based system.
The current auth system use passport.js to authenticate by redirecting to certain URL and getting cookie in return, but this cannot be done in react native, as no way to capture incoming httpsafe cookie.
I am confused how should I handle this, according to me session based system can be replaced by JWT based system, but i'll need to change entire auth flow.
Any suggestions on it?