Live data from Hacker News

Learn OAuth by building a client with Node.js

annotate.dev

11–20 of 29 posts

Re: Learn OAuth by building a client with Node.js

#11

What I learned from writing my own auth(OAuth as well) something, it's not worth the time and effort. Great learning opportunity, with way too many footguns.

Agreed, I think it's something you should know how to do and then choose not to do it (use an existing library instead). Having a good understanding really helps with debugging issues that come up.

Re: Learn OAuth by building a client with Node.js

#12

Hey HN, author here. When I was first learning OAuth, I found that all the guides were text-heavy and lacked code. I personally learn better from code, so I created a code-first guide. Let me know if you have any feedback!

It's a decent skeleton for a server side client. You might consider showing how a token refresh might work.

There is often a need for public client side implementations as well. Are you planning on making one there? It's mostly the same idea but you do the redirects yourself with CSRF and PKCE.

Re: Learn OAuth by building a client with Node.js

#16
post #13

For those looking for production-level OAuth libs, the best implementation for all JS runtimes is https://github.com/panva/oauth4webapi Certified, thoroughly tested, zero deps, fully typed, secure defaults, works in Node/Deno/Bun/Edge, supports PKCE/dPoP/etc.

Certified by the person who wrote the library? I guess I also certify it

Re: Learn OAuth by building a client with Node.js

#17

Hey HN, author here. When I was first learning OAuth, I found that all the guides were text-heavy and lacked code. I personally learn better from code, so I created a code-first guide. Let me know if you have any feedback!

I really enjoyed the way you presented that, really helped me to focus while reading.

Re: Learn OAuth by building a client with Node.js

#18
post #13

For those looking for production-level OAuth libs, the best implementation for all JS runtimes is https://github.com/panva/oauth4webapi Certified, thoroughly tested, zero deps, fully typed, secure defaults, works in Node/Deno/Bun/Edge, supports PKCE/dPoP/etc.

Certified by the person who wrote the library? I guess I also certify it

I'll certify your certification!

Re: Learn OAuth by building a client with Node.js

#19
In what cases is this kindof plain auth code flow still considered good enough from security POV?

There's advice eg https://www.oauth.com/oauth2-servers/pkce/ that seems to say you should PKCE it even in server-side auth code flow use cases:

> PKCE was originally designed to protect the authorization code flow in mobile apps, and was later recommended to be used by single-page apps as well. In later years, it was recognized that its ability to prevent authorization code injection makes it useful for every type of OAuth client, even apps running on a web server that use a client secret.

Re: Learn OAuth by building a client with Node.js

#20
post #13

For those looking for production-level OAuth libs, the best implementation for all JS runtimes is https://github.com/panva/oauth4webapi Certified, thoroughly tested, zero deps, fully typed, secure defaults, works in Node/Deno/Bun/Edge, supports PKCE/dPoP/etc.

Certified by the person who wrote the library? I guess I also certify it

AFAIK there's no "certifying body" that would be able to provide an external "certification".

In any case Filip Skokan has essentially made a career out of building open source OAuth stuff, so even if it's a bit humorous that he certifies his own stuff, it's likely that this implementation is one of the most compliant out there.

Post reply on HN