Social login trigger a script

Hi all,

Just wanted to ask if there’s a way an social login can trigger a (before or after) script, so we can run some API endpoints prior to logging in?

Basically, what we need to check is if the social logging in user is available in our API, we then process either allow or reject depending on its response?

Appreciate the help.