Introduction to OAuth 2.0 for beginners
Concepts that you need to know
Authentication: verifies the identity of a user or service.
Authorization: determines their access rights.
API: we guarantee access to the resource we wish to access (SOAP, REST).
Resource: data for example images, file and services, etc.
Oauth2 is a framework and protocol that defined forms, rules or medium how to access reource (data).
JWT: JSON Web Token is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object.
Bearer: Bearer tokens are a much simpler way of making API requests
in first example we trust in this client and in the second case we have a malicious client that is having access to our endpoint, then we answer that you take the data, because we do not have any mechanism to access that data, so the big question is do we trust all our clients?
So to create this mechanism, the idea is that every client that wants to access the resource (data) must have an authorization token to verify that it can and does have permissions to access that data.
Conclusion
If you need to validate that not any client will be able to access your resource and want to protect that resource, oath2 is a good alternative to protect your resource, because malicious clients will want to access your resource and without protection any client will be able to access your resource. So Oauth2.0 is a good alternative.
Thank you for reading!