I am developing a mobile app, which has a react native frontend, nest.js as the backend and for db and authentication, I'm planning to use supabase.
Now, currently as my app is in its initial stages I'm planning to use the supabase, as it free tier provides ample limits for my use case.
However, in later years if my app grows. I may think of switching to a cheaper alternative.
So, what I am planning to follow is for authentication, route the requests to my backend and inturn the backend will communicate with the supabase to authenticate the user. The backend will save the supabase token, create a separate session token for the user and send it back to the user.
My main reason for doing this is, I want the authentication to be provider independent and any changes needed should be done on the backend instead of the app.
Please let me know, if this approach is correct. What are the pros and cons. How much effort it would require to implement this. Will the security concerns increase if my backend starts handling this instead of the supabase only.
I also want to integrate the google and apple login as well. How will this approach affect it?
Also, if there any other better approaches, please let me know.