by davedx · 3y ago · 0 comments
These days with a lot of non-standards-compliant OAuth implementations behind me, my conclusion is a lot of it is a giant waste of time, and it often adds completely pointless complexity for many of the cases it's used for. And as shown in the article, all the complexity often adds exploit vectors.
For 90% of API use cases just issue a revokable Bearer Token and be done with it. You are not an app platform!!!
[Qualifier: the EV API's I experimented with were a good use-case for OAuth, as they were user-first, based on mobile apps authenticated with user/password credentials. But I've worked with a lot of third party vendor API's where it was purely server-to-server access, but for some reason wrapped in OAuth... because... architects and compliance something something]
As someone who's implemented a bunch of these..
It's less about compliance and more about getting everything "speaking OAuth"
Once you've converted your user-facing flows to use OAuth and you're dealing with scopes, tokens, etc, converting the backend to also use it makes a lot of sense. Then you have ONE path for token validation, inspecting/validating scopes, and client id/secret issuance whether you're on the front or back end. Having one model for people to understand makes things tangibly simpler and shrinks the libraries/tools you need.
If you ONLY have backend (service to service) flows with a simple authZ model, OAuth is usually overkill.
There are only two real use cases for the complexity of OAuth.
1. SAAS model and you're allowing your customers to use their own IDP
2. You really and truly have a lot of disparate internal systems that need SSO.
And 2 generally has better solutions.
you fail to mention them.
That sometimes feels like the bane of my existence. Everything has to be OAuth and use refresh tokens, certificates etc. when I never care or use any user data. No one logs in. This is all our server talking to their server. Revokable Bearer Tokens used to be used, but every API that updates switched to OAuth which makes everything more complicated.
They then pluck the authorised token out of the cookie store.
There are right and wrong ways to do OAuth both in server and client, and many, many implementations do it wrong.
Not when you don't have an 'official' redirect URL.
Then you send the auth code to your backend instead.
At work the tooling we use for our services outright requires OAuth if you want authentication. And yeah, that's a large factor implying we should use something else, but there are many coordination problems for that.
I imagine plenty of people have a similar problem.
Anyway, if your client is saving your password, then I'd say that's not a good use-case for OAuth. At this point I'm not sure there exist a good use-case for OAuth.