I'm having some troubles understanding how OAUTH-v2 works.
The OAuth version 2 spec reads:
Accessing Protected Resources
The client accesses protected resources by presenting the access
token to the resource server. The resource server MUST validate the
access token and ensure it has not expired and that its scope covers
the requested resource. The methods used by the resource server to
validate the access token (as well as any error responses) are beyond the scope of this specification, but generally involve an interaction or coordination between the resource server and the authorization
server.
How does this interaction between resource server and authorization server work in practice?
- How does the resource server determine that an access token it received is valid?
- How does the resource server extract the allowed scope from the token to see if access should be granted to a particular resource? Is the Scope encoded in the access token, or does the resource server first have to contact the authorization server?
- How is trust between the resource server and the authorization server established?
Access token attributes and the methods used to access protected resources are beyond the scope of this specification and are defined by companion specifications.
Can someone give examples for token attributes?