Social Media Posting App

Hello everyone!
I was wondering if there is a way to build an app, where users can "log in to their social media accounts" and therefore enable the app to post on the social platform. I thought about doing this with some custom code and an API call to the social media platform, I also found a post here where someone presented this with "Ayrshare".
Build A Social Media Posting App With Retool
My main concern however is data security.
The ideal software would work like Zapier for example, where you just connect your account and then the app can post for you automatically.
Is this possible? Has anyone done something like this? What are the best practices? Thanks a lot everyone!