3 ms·
Hey HN, I wanted to be able to make apps that do social login with HN so I hacked it together. It works like you would expect -- generating a code you can put
by hardwaresofton 5y ago
Hey HN,
I wanted to be able to make apps that do social login with HN so I hacked it together.
It works like you would expect -- generating a code you can put in your profile. For convenience, you can then use either TOTP or Email (if you specify both, it will default to using TOTP) to login thereafter to make things quicker (it can take up to a minute until profiles update).
I generally wait about 5 seconds between checks of a profile, hopefully this isn't too much additional strain (especially since I expect most people to switch to something faster after the first login).
[EDIT] Also it's night time (well morning I guess) where I am so... spinning up some more instances and I'm going to sleep.
[EDIT2] My email is plastered all over the site, but please feel free to email me any bug reports!
[EDIT3] If you'd like to register an app, please check out https://mailing-list.vadosware.io/subscription/form https://mailing-list.vadosware.io/subscription/form ! Ignore all the other mailing list stuff and get on the "early adopters" list for LoginWithHN! Or just email me in my HN profile, whichever!
- will0 5y ago> you can then use either TOTP or Email (if you specify both, it will default to using TOTP) to login thereafter to make things quicker (it can take up to a minute until profiles update). I guess at this point it's more like login with loginwithhn?
- hardwaresofton 5y agoYup! LoginWithHN is the OAuth provider :) so the idea is if you have an app that you want people to use to login with HN, via LoginWithHN then you can use loginwithhn.com to make it happen
- timoteostewart 5y agoNice work! If there was a similar yet less efficient implementation of your idea, I guess we’d call it “nlogn with hn”!
- shreddit 5y agoMore like register with loginwithhn?
- dang 5y ago> I generally wait about 5 seconds between checks of a profile If you're scraping HN, please wait 30 seconds (https://news.ycombinator.com/robots.txt https://news.ycombinator.com/robots.txt) - our app server still runs on a single core, so we don't have a lot of performance to spare. (Hopefully that will change this year.) If you need to check more frequently, https://github.com/HackerNews/API https://github.com/HackerNews/API works fine and you can get JSON that way anyhow.
- hardwaresofton 5y agoHey Dang, so actually I DO wait 30 seconds -- what actually happens is that I check on the frontend every 5, but the backend checks every 30 (that's the default) interval. If you can believe it the code looks something like this: export const DEFAULT_HN_POLL_DELAY_MS = "30000"; export const DEFAULT_HN_POLL_MAX_CHECKS = 10; The code isn't F/OSS but I hope you can take my word on this, worst case what happens is that someone launches two intervals (I don't have any locking on that side) due to hitting two different machines. I'll be switching to the API by the end today and worst case by the weekend. [EDIT] Forgot to add this -- hope I didn't cause any disruption on your end. thanks for all the hard work as always.
- dang 5y agoThat sounds fine!
- somishere 5y agoRather than polling you can probably just subscribe (via Firebase[1] and the HN API) to changes to the user's profile e.g[2] [1] https://firebase.google.com/docs/libraries#client-sdks https://firebase.google.com/docs/libraries#client-sdks [2] https://hacker-news.firebaseio.com/v0/user/hardwaresofton/about.json?print=pretty https://hacker-news.firebaseio.com/v0/user/hardwaresofton/ab...
- hardwaresofton 5y agoHey thanks for the suggestion, I'll check this out as well -- I definitely don't mind having more ways to check so I can spread load and what not.