Is it better to implement Social Login/Authentication in the frontend (React) of an application or backend (FastAPI)
I am building a full-stack application using React for the frontend and FastAPI for the backend with PostgreSQL database. I am aware the most answers for my question have been "do both" but to me that is quite vague an answer. To be more specific with an example, I can have two ways of adding the Google authentication method in my application,
Using FastAPI and this article to simply provide the frontend with the google auth button https://medium.com/data-rebels/fastapi-google-as-an-external-authentication-provider-3a527672cf33
Using React and this package https://www.npmjs.com/package/react-social-login to implement social login in the frontend but still do some form of authentication with tokens in the backend.
My question is, which option is easier to implement and more secure.
Source: React – Stack OverflowNovember 21, 2021