It sounds like OpenWebAuth was created to do just that.
Fwiw I think pixelfed supports "sign in with Mastodon" already.