TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

When is OAuth2 and Open ID Connect Useful?

87 pointsby claystrawabout 3 years ago

11 comments

awkwardabout 3 years ago
The current state of authentication consumes massive amounts of time, money and effort on any given development platform. The author's advice is great, but Oauth2 is absolutely not the end state for distributed identity, and the new thing can't come soon enough.
Kletiomabout 3 years ago
Puh the article has the same problem as auth always has: lots and lots of magic words which are hard to remember what one word exactly means.<p>We just use keycloak everywhere and I don&#x27;t know if our setup uses oauth, sso, jwt,oauth2, open id, saml etc.<p>Keycloak library works, configuring Google as an additional provider is easy.<p>I trust that setup but it would be great if we would just have one thing with x features and everyone supports it.<p>You want to connect Fe with be? Use a.<p>You need API token&#x2F;auth, use b.<p>You want to allow auth from ext? Use c.<p>What I will not do though, auth as a service. I add Google and co because the customer is thrusting them.
triggercutabout 3 years ago
OAuth2 and Open ID Connect (and FAPI) underpin the design of both the UK and Australian Open Banking systems. The Australian design (Consumer Data Right) is even starting to extend into other sectors beyond banking, such as Energy and Telecommunications, where &quot;Data Holders&quot; (sector specific companies, think your bank, your power company, your telco etc.) must become identity providers so consumers can log-in and grant access to new third party products (Data Recipients) who will provide value added services on top of your data (account aggregation, bill smoothing, who knows) via standard APIs. This is reflected in law and compliance is monitored by a government agency.<p>Other countries are watching these examples before undertaking their own versions.<p>The future could be built on it.
Softcadburyabout 3 years ago
Can&#x27;t agree more with this article! How I see it, the trend is to have different servers for the front and the back and to link them with OIDC, but that&#x27;s so painfull to implement and with lot of downsides for only a few benefits (at least with the back in .Net, I don&#x27;t know about other).
adaluabout 3 years ago
The problem with oa2&#x2F;oidc is client integrations on the client side.<p>Many commercial offers, but in reality on the foss side they&#x27;re a major PITA. At least if you&#x27;re looking for a painless solution in the hybrid app world aka it should work for web and mobile with the same codebase.<p>I&#x27;m using Keycloak but keycloak adapter &#x27;cordova-native&#x27; isn&#x27;t working and you need deep links which are no longer maintained etc. It&#x27;s a mess.<p>If you&#x27;re just looking to secure your HTTP APIs or your SSR or classic site, there are many working and simple options, but on the presentation side it&#x27;s a fugly mess.
Jenkabout 3 years ago
(New?) title of article is a little less evocative:<p>&gt; Why you probably do not need OAuth2 &#x2F; OpenID Connect
mro_nameabout 3 years ago
There&#x27;s quite some cargo cult – e.g. jwt and oauth2 often appear like that, when a simpler design is discarded because &#x27;that&#x27;s the way&#x27;.<p>If you can design a system without accounts (shortly here on HN), you won&#x27;t miss oauth2.
intrasightabout 3 years ago
&gt;Why you probably do not need OAuth2<p>You need it if that&#x27;s all that your vendor is offering
jillesvangurpabout 3 years ago
Oauth2 is commonly used to protect APIs. It&#x27;s very simple in that mode. Use your credentials (user password or whatever) and get a token with some expiry time and use it. When it is about to expire, get another one via a refresh API. Most well known REST APIs have used this for the last 12 or so years and it&#x27;s not hard to implement even without a lot of library support. Most importantly, it follows the principle of the least amount of surprise. People who have used web APIs before, will have likely dealt with this before. I&#x27;ve been building APIs with some form of OAuth2 api protection for many years. Its a very standard thing at this point. I&#x27;ve also used NTLM and OAuth1 tokens for this in the past. Simple HMACs also used to be a thing with e.g. xml-rpc. And before that people just passed around session cookies; which especially over http had some obvious security issues.<p>These days, many APIs are stateless and there is no server side session. There&#x27;s just authentication tokens. These tokens may be random numbers, some kind of signed token, or a JWT. Which it is does not really matter for the user. It&#x27;s just an opaque string. In the case of JWTs the string might be a bit long and contain some data.<p>The notion that OAuth2 is not about authentication is kind of a half truth. You use your user&#x2F;password or some other credentials to get a token via one of its flows. So, that is an authentication process of course. That token gives you access to an API. That&#x27;s technically authorizing access. However, when you make requests to an API that is stateless, it&#x27;s also a form of authentication. It does not know who you are until it inspects the token. The process of verifying that somebody is who they claim to be is usually called authentication. And a typical OAuth2 API will do that by verifying the signature of the token.<p>The token might also include information as to what they are actually authorized to do (e.g. via a scope or some other sort of claim in a JWT). But that is optional. I typically use role based security and I don&#x27;t rely on tokens to transmit any information about which roles a user has. That is simply looked up from a database when the request comes in and used to determine which of a very long list of privileges they have. We assign roles to users and we verify privileges to authorize their access. If an admin assigns new roles to a user, their tokens are still valid but they are now authorized to do different things with it. So arguably, it&#x27;s an authentication token and not an authorization token if you use it like that. The actual authorization is based on what roles you have. The token does not include any information about that. It just confirms that the user is who they claim to be. It could include that of course and with some APIs that is a thing. But with ours it just isn&#x27;t. It&#x27;s just an identity proof and we use it exactly like we would use a user password combination: we verify it is correct and valid.<p>Most modern apps don&#x27;t have a notion of server side sessions. That&#x27;s a thing from late last century and the beginning of this century. You can still do that of course but it&#x27;s just less common unless you use stuff like ruby on rails or some older php frameworks.<p>But most full page applications or mobile applications talk to APIs using tokens. If your app is like that, I&#x27;d argue that you&#x27;d pretty much should support oauth2 unless you have a really good reason not to. And that that is not such a big deal. Not all of it but just the handful of the flows related to getting a token via the login flow and (optionally) refreshing it. The simplest way to get a token is basic authentication over https. You can implement a few variations of that that e.g. use a basic authentication header; a post form; a json API, etc. The standard is not particularly concerned with naming and form of things unfortunately. That&#x27;s always been the issue with OAuth; there&#x27;s too much freedom with respect to naming things, what to actually send over the wire, etc. Using the token usually means passing an Authorization header with as the value &quot;Bearer xxxx&quot; where xxxx is the token. But I&#x27;ve also seen APIs where they simply shove that in a post parameter, the json or even the url. As a standard OAuth2 is both very complex and unders pecified. But the good news is that the easy parts of it are all you need. It&#x27;s all the less common flows that you probably should not worry about because you don&#x27;t need them.<p>OpenID Connect has the similar issues. Very common if you want to add a e.g. Github or Google authentication flow to your website. It&#x27;s a bit better standardized but still with a lot of annoying vendor specific variation in each implementation. And it may or may not include authorization information. Technically the tokens you end up with are either used as OAuth2 tokens or used to get one. It&#x27;s ultimately just a convoluted way to get an OAuth2 token.
littlecranky67about 3 years ago
OAuth2 was designed in a time when everybody thought consolidating logins would be wise, and just use Google &#x2F; Facebook &#x2F; Microsoft accounts to login everyhwere.<p>OAuth2 was production ready when everybody realized having FAANG logins is insane, as they use it to massively track you on websites that else would be beyond their reach. And since reports off random FAANG account shutdowns, it is even wise not to use them when you are okay with tracking, as suddenly a handfull of FAANG megacorps have the power to shut down your digital life with a click.<p>So here we are, having to deal with massive protocol overhead for a feature most of us don&#x27;t want anymore.
评论 #30521326 未加载
评论 #30524579 未加载
stillbourneabout 3 years ago
I&#x27;d rather use an over engineered solution that has lots of libraries available for implementation than to build a home baked auth solution that&#x27;s based off of ignorance.
评论 #30514996 未加载
评论 #30515187 未加载
评论 #30526168 未加载
评论 #30515392 未加载