Authentication using 3rd Party (custom) Logic

I’m trying to write a plugin that will allow you to login to discourse with some “custom” logic
No username and password, maybe a Pin Number or a One Time Token you generate.
I am willing to write the logic etc, but I’m new to Discourse Development so I’m trying to understand if that’s possible.

I’ve looked at all/most of the Authentication plugins available and most of them just use some off the shelf Gem and 10-20 lines of code to make ti work.
Which is great, however in my case I need completely custom logic.

Just wondering if there’s anything out there I can use as an example say username / password auth or something of the sort.
Or of anyone can point me in the right direction.

The goal was to leverage the same functionality as you get when you add other accounts (Google, Facebook etc)
Just add another “related” account that you can Auth Against. 1 to 1 relationship between Discourse user and my “Token” (If that helps)

This is a learning exercise I have a very active discourse community and I would love to be able to contribute


Perhaps you can use a service that provides the type of authentication you’re after, but talks to Discourse with a standard protocol?(Like OpenID Connect?)

Is this alternative method meant to be related to existing user accounts, or is it some form of anonymous authorized login? If it’s linked to an existing account, then you might like to use an external identity service like Keycloak? AFAIK it can support OTP(One Time Password) and a variety of other methods. Might not be easier though.