Custom Login / Registration from another API

You can look at Official Single-Sign-On for Discourse (sso) and OAuth2 Basic Support.