lichess-org / api

Lichess API documentation and examples
https://lichess.org/api
GNU Affero General Public License v3.0
450 stars 152 forks source link

API example backend using passport-oauth2 #258

Open ddugovic opened 1 year ago

ddugovic commented 1 year ago

I'm trying to add "Login with Lichess" support to my Discord bot, so it can call Discord's API to assign a "linked role".

I've never worked with Express or OAuth2 before, and am having difficulty understanding example https://github.com/lichess-org/api/tree/master/example/oauth-backend . Somehow https://www.passportjs.org/packages/passport-oauth2/ looks easier to follow, however I haven't used Express before...

Since I don't have an HTTPS domain, whatever webserver code I create likely would be throwaway code, but I assume I'm not the only consumer looking to use OAuth2 with Lichess. For example, my Square Off board can't securely log in with 2FA, and DIY digital board creators might appreciate having a simple example to follow, and somehow passport-oauth2 doesn't look intimidating. But again, maybe I don't know what I'm talking about.

Also, https://www.passportjs.org provides login strategies for Facebook, Twitter, Google, etc.; for SEO reasons it might be cool to get a "Login with Lichess" strategy listed there, although it sounds like passport-oauth2 is what I was looking for.

Nagol12344 commented 8 months ago

You may waant to look at this package: https://github.com/ornicar/passport-lichess .