Access Tokens: Permission an App Can Carry
Token-based access control uses a digital credential, called a token, to decide whether software may use a protected resource. Instead of sending an account password with each request, an application presents a token that represents a particular set of permissions.
That permission can be narrower than everything the account holder may do. Suppose you want an app to read files from a storage service but not delete them. A token can represent the allowed reading access without giving the app your password or the full reach of your account.
OAuth is a framework for arranging this kind of authorization. Authorization means deciding what an application may do; authentication checks a claimed identity. They are related jobs, but signing in doesn't answer every later permission question.
How an App Gets Access Without Getting Your Password
Follow the permission to the file
In an OAuth arrangement, an authorization server issues the access token. The client is the app requesting access. The resource server holds or provides the protected information—in this example, the files.
The client presents the token when it asks for a file. The receiving service has to validate it and decide whether it covers that request. A token meant for one service shouldn't become permission to use an unrelated one.
The token's scope describes the permitted access. Its lifetime limits how long it may be accepted. The OAuth specification describes access tokens in terms of scope and duration, rather than as universal identity cards.
The reading app can therefore have a valid token and still be refused when it asks to delete a file. That refusal is the access rule working.
Some tokens carry details; others point to them
A token can be an opaque value: a string whose meaning the service looks up in its own records. Alternatively, it can carry information that the service can verify.
A JSON Web Token, or JWT, is one possible format for carrying named statements between systems, such as who issued a token and when it expires. It isn't the required format for every access token. Nor should a complicated-looking token be assumed to contain encrypted information.
The receiving service still checks who issued the token, whether it's acceptable here and what it permits. Merely finding a token in a request doesn't make the request authorized.
- Make a stolen password useless without the key in your hand.
- Sign in with a tap instead of typing a code.
- Protect Google, Microsoft, Apple and more than 1,000 other accounts.
A copied token can carry the same permission
With a bearer token, possession is enough to use the associated access; the holder doesn't separately prove control of a cryptographic key, secret data used to produce a mathematical proof. That's why the bearer-token standard requires protecting tokens in storage and while they travel.
Expiration puts a time limit on use. Revocation withdraws a token's acceptance before its natural expiry. These aren't interchangeable, and revocation can take time to reach other servers, as its specification explains.
Current OAuth security guidance also describes restricting tokens to intended services and limited privileges, as well as binding some tokens to a sender's key. Those measures reduce what misuse can accomplish. In the file example, a stolen read-only token can still expose documents, even if it can't delete them. Narrow permission limits the damage; it doesn't make theft harmless.
JWT: The Readable Token a Service Still Has to Check

Authorization: Who Can Do What With Which Data?

Least Privilege: Give Each Account the Power Its Work Needs

QUOTE:
"Amateurs hack systems, professionals hack people."
