draft-ietf-oauth-v2-16.txt   draft-ietf-oauth-v2-17.txt 
Network Working Group E. Hammer-Lahav, Ed. Network Working Group E. Hammer-Lahav, Ed.
Internet-Draft Yahoo! Internet-Draft Yahoo!
Obsoletes: 5849 (if approved) D. Recordon Obsoletes: 5849 (if approved) D. Recordon
Intended status: Standards Track Facebook Intended status: Standards Track Facebook
Expires: November 20, 2011 D. Hardt Expires: January 9, 2012 D. Hardt
Microsoft Microsoft
May 19, 2011 July 8, 2011
The OAuth 2.0 Authorization Protocol The OAuth 2.0 Authorization Protocol
draft-ietf-oauth-v2-16 draft-ietf-oauth-v2-17
Abstract Abstract
The OAuth 2.0 authorization protocol enables a third-party The OAuth 2.0 authorization protocol enables a third-party
application to obtain limited access to an HTTP service, either on application to obtain limited access to an HTTP service, either on
behalf of an end-user by orchestrating an approval interaction behalf of a resource owner by orchestrating an approval interaction
between the end-user and the HTTP service, or by allowing the third- between the resource owner and the HTTP service, or by allowing the
party application to obtain access on its own behalf. third-party application to obtain access on its own behalf.
Status of this Memo Status of this Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on November 20, 2011. This Internet-Draft will expire on January 9, 2012.
Copyright Notice Copyright Notice
Copyright (c) 2011 IETF Trust and the persons identified as the Copyright (c) 2011 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1. Roles . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.1. Roles . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2. Protocol Flow . . . . . . . . . . . . . . . . . . . . . . 5 1.2. Protocol Flow . . . . . . . . . . . . . . . . . . . . . . 6
1.3. Access Token . . . . . . . . . . . . . . . . . . . . . . 6 1.3. Access Token . . . . . . . . . . . . . . . . . . . . . . 7
1.4. Authorization Grant . . . . . . . . . . . . . . . . . . . 7 1.4. Authorization Grant . . . . . . . . . . . . . . . . . . . 8
1.4.1. Authorization Code . . . . . . . . . . . . . . . . . . 8
1.4.2. Implicit . . . . . . . . . . . . . . . . . . . . . . . 8
1.4.3. Resource Owner Password Credentials . . . . . . . . . 9
1.4.4. Client Credentials . . . . . . . . . . . . . . . . . . 9
1.4.5. Extensions . . . . . . . . . . . . . . . . . . . . . . 9
1.5. Refresh Token . . . . . . . . . . . . . . . . . . . . . . 9 1.5. Refresh Token . . . . . . . . . . . . . . . . . . . . . . 9
1.6. Document Structure . . . . . . . . . . . . . . . . . . . 11 1.6. Notational Conventions . . . . . . . . . . . . . . . . . 11
1.7. Notational Conventions . . . . . . . . . . . . . . . . . 11 2. Client Registration . . . . . . . . . . . . . . . . . . . . . 11
2. Protocol Endpoints . . . . . . . . . . . . . . . . . . . . . . 11 2.1. Client Types . . . . . . . . . . . . . . . . . . . . . . 12
2.1. Authorization Endpoint . . . . . . . . . . . . . . . . . 12 2.2. Registration Requirements . . . . . . . . . . . . . . . . 12
2.2. Token Endpoint . . . . . . . . . . . . . . . . . . . . . 13 2.3. Client Identifier . . . . . . . . . . . . . . . . . . . . 12
3. Client Authentication . . . . . . . . . . . . . . . . . . . . 14 2.4. Client Authentication . . . . . . . . . . . . . . . . . . 12
3.1. Client Password Authentication . . . . . . . . . . . . . 15 2.4.1. Client Password . . . . . . . . . . . . . . . . . . . 13
3.2. Other Client Authentication Methods . . . . . . . . . . . 16 2.4.2. Other Authentication Methods . . . . . . . . . . . . . 14
4. Obtaining Authorization . . . . . . . . . . . . . . . . . . . 16 2.5. Unregistered Clients . . . . . . . . . . . . . . . . . . 14
4.1. Authorization Code . . . . . . . . . . . . . . . . . . . 16 3. Protocol Endpoints . . . . . . . . . . . . . . . . . . . . . . 14
4.2. Implicit Grant . . . . . . . . . . . . . . . . . . . . . 22 3.1. Authorization Endpoint . . . . . . . . . . . . . . . . . 14
4.3. Resource Owner Password Credentials . . . . . . . . . . . 28 3.1.1. Response Type . . . . . . . . . . . . . . . . . . . . 15
4.4. Client Credentials . . . . . . . . . . . . . . . . . . . 30 3.1.2. Redirection URI . . . . . . . . . . . . . . . . . . . 16
4.5. Extensions . . . . . . . . . . . . . . . . . . . . . . . 32 3.2. Token Endpoint . . . . . . . . . . . . . . . . . . . . . 18
5. Issuing an Access Token . . . . . . . . . . . . . . . . . . . 33 3.2.1. Client Authentication . . . . . . . . . . . . . . . . 18
5.1. Successful Response . . . . . . . . . . . . . . . . . . . 33 4. Obtaining Authorization . . . . . . . . . . . . . . . . . . . 19
5.2. Error Response . . . . . . . . . . . . . . . . . . . . . 34 4.1. Authorization Code . . . . . . . . . . . . . . . . . . . 19
6. Refreshing an Access Token . . . . . . . . . . . . . . . . . . 36 4.1.1. Authorization Request . . . . . . . . . . . . . . . . 21
7. Accessing Protected Resources . . . . . . . . . . . . . . . . 37 4.1.2. Authorization Response . . . . . . . . . . . . . . . . 22
7.1. Access Token Types . . . . . . . . . . . . . . . . . . . 38 4.1.3. Access Token Request . . . . . . . . . . . . . . . . . 24
8. Extensibility . . . . . . . . . . . . . . . . . . . . . . . . 38 4.1.4. Access Token Response . . . . . . . . . . . . . . . . 25
8.1. Defining Access Token Types . . . . . . . . . . . . . . . 38 4.2. Implicit Grant . . . . . . . . . . . . . . . . . . . . . 25
8.2. Defining New Endpoint Parameters . . . . . . . . . . . . 39 4.2.1. Authorization Request . . . . . . . . . . . . . . . . 28
8.3. Defining New Authorization Grant Types . . . . . . . . . 39 4.2.2. Access Token Response . . . . . . . . . . . . . . . . 29
8.4. Defining Additional Error Codes . . . . . . . . . . . . . 39 4.3. Resource Owner Password Credentials . . . . . . . . . . . 32
9. Native Applications . . . . . . . . . . . . . . . . . . . . . 40 4.3.1. Authorization Request and Response . . . . . . . . . . 33
10. Security Considerations . . . . . . . . . . . . . . . . . . . 41 4.3.2. Access Token Request . . . . . . . . . . . . . . . . . 33
10.1. Client Authentication . . . . . . . . . . . . . . . . . . 42 4.3.3. Access Token Response . . . . . . . . . . . . . . . . 34
10.2. Client Impersonation . . . . . . . . . . . . . . . . . . 42 4.4. Client Credentials . . . . . . . . . . . . . . . . . . . 34
10.3. Access Token Credentials . . . . . . . . . . . . . . . . 43 4.4.1. Authorization Request and Response . . . . . . . . . . 35
10.4. Refresh Tokens . . . . . . . . . . . . . . . . . . . . . 43 4.4.2. Access Token Request . . . . . . . . . . . . . . . . . 35
10.5. Request Confidentiality . . . . . . . . . . . . . . . . . 44 4.4.3. Access Token Response . . . . . . . . . . . . . . . . 36
10.6. Endpoints Authenticity . . . . . . . . . . . . . . . . . 44 4.5. Extensions . . . . . . . . . . . . . . . . . . . . . . . 36
10.7. Credentials Guessing Attacks . . . . . . . . . . . . . . 44 5. Issuing an Access Token . . . . . . . . . . . . . . . . . . . 37
10.8. Phishing Attacks . . . . . . . . . . . . . . . . . . . . 44 5.1. Successful Response . . . . . . . . . . . . . . . . . . . 37
10.9. Authorization Codes . . . . . . . . . . . . . . . . . . . 45 5.2. Error Response . . . . . . . . . . . . . . . . . . . . . 39
10.10. Session Fixation . . . . . . . . . . . . . . . . . . . . 45 6. Refreshing an Access Token . . . . . . . . . . . . . . . . . . 40
10.11. Redirection URI Validation . . . . . . . . . . . . . . . 46 7. Accessing Protected Resources . . . . . . . . . . . . . . . . 41
10.12. Resource Owner Password Credentials . . . . . . . . . . . 46 7.1. Access Token Types . . . . . . . . . . . . . . . . . . . 42
10.13. XSRF/CSRF Prevention . . . . . . . . . . . . . . . . . . 46 8. Extensibility . . . . . . . . . . . . . . . . . . . . . . . . 43
11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 46 8.1. Defining Access Token Types . . . . . . . . . . . . . . . 43
11.1. The OAuth Access Token Type Registry . . . . . . . . . . 46 8.2. Defining New Endpoint Parameters . . . . . . . . . . . . 43
11.2. The OAuth Parameters Registry . . . . . . . . . . . . . . 48 8.3. Defining New Authorization Grant Types . . . . . . . . . 44
11.3. The OAuth Extensions Error Registry . . . . . . . . . . . 51 8.4. Defining New Authorization Endpoint Response Types . . . 44
12. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 52 8.5. Defining Additional Error Codes . . . . . . . . . . . . . 44
Appendix A. Editor's Notes . . . . . . . . . . . . . . . . . . . 53 9. Native Applications . . . . . . . . . . . . . . . . . . . . . 45
13. References . . . . . . . . . . . . . . . . . . . . . . . . . . 53 10. Security Considerations . . . . . . . . . . . . . . . . . . . 46
13.1. Normative References . . . . . . . . . . . . . . . . . . 53 10.1. Client Authentication . . . . . . . . . . . . . . . . . . 47
13.2. Informative References . . . . . . . . . . . . . . . . . 54 10.2. Client Impersonation . . . . . . . . . . . . . . . . . . 47
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 55 10.3. Access Token Credentials . . . . . . . . . . . . . . . . 48
10.4. Refresh Tokens . . . . . . . . . . . . . . . . . . . . . 48
10.5. Request Confidentiality . . . . . . . . . . . . . . . . . 49
10.6. Endpoints Authenticity . . . . . . . . . . . . . . . . . 49
10.7. Credentials Guessing Attacks . . . . . . . . . . . . . . 49
10.8. Phishing Attacks . . . . . . . . . . . . . . . . . . . . 49
10.9. Authorization Codes . . . . . . . . . . . . . . . . . . . 50
10.10. Authorization Code Leakage . . . . . . . . . . . . . . . 50
10.11. Redirection URI Validation . . . . . . . . . . . . . . . 51
10.12. Resource Owner Password Credentials . . . . . . . . . . . 51
10.13. Cross-Site Request Forgery . . . . . . . . . . . . . . . 51
10.14. Clickjacking . . . . . . . . . . . . . . . . . . . . . . 52
11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 52
11.1. The OAuth Access Token Type Registry . . . . . . . . . . 52
11.1.1. Registration Template . . . . . . . . . . . . . . . . 53
11.2. The OAuth Parameters Registry . . . . . . . . . . . . . . 53
11.2.1. Registration Template . . . . . . . . . . . . . . . . 54
11.2.2. Initial Registry Contents . . . . . . . . . . . . . . 54
11.3. The OAuth Authorization Endpoint Response Type
Registry . . . . . . . . . . . . . . . . . . . . . . . . 56
11.3.1. Registration Template . . . . . . . . . . . . . . . . 57
11.3.2. Initial Registry Contents . . . . . . . . . . . . . . 57
11.4. The OAuth Extensions Error Registry . . . . . . . . . . . 57
11.4.1. Registration Template . . . . . . . . . . . . . . . . 58
12. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 59
Appendix A. Editor's Notes . . . . . . . . . . . . . . . . . . . 59
13. References . . . . . . . . . . . . . . . . . . . . . . . . . . 60
13.1. Normative References . . . . . . . . . . . . . . . . . . 60
13.2. Informative References . . . . . . . . . . . . . . . . . 61
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 62
1. Introduction 1. Introduction
In the traditional client-server authentication model, the client In the traditional client-server authentication model, the client
accesses a protected resource on the server by authenticating with accesses a protected resource on the server by authenticating with
the server using the resource owner's credentials. In order to the server using the resource owner's credentials. In order to
provide third-party applications access to protected resources, the provide third-party applications access to protected resources, the
resource owner shares its credentials with the third-party. This resource owner shares its credentials with the third-party. This
creates several problems and limitations: creates several problems and limitations:
o Third-party applications are required to store the resource- o Third-party applications are required to store the resource
owner's credentials for future use, typically a password in clear- owner's credentials for future use, typically a password in clear-
text. text.
o Servers are required to support password authentication, despite o Servers are required to support password authentication, despite
the security weaknesses created by passwords. the security weaknesses created by passwords.
o Third-party applications gain overly broad access to the resource- o Third-party applications gain overly broad access to the resource
owner's protected resources, leaving resource owners without any owner's protected resources, leaving resource owners without any
ability to restrict duration or access to a limited subset of ability to restrict duration or access to a limited subset of
resources. resources.
o Resource owners cannot revoke access to an individual third-party o Resource owners cannot revoke access to an individual third-party
without revoking access to all third-parties, and must do so by without revoking access to all third-parties, and must do so by
changing their password. changing their password.
o Compromise of any third-party application results in compromise of
the end-user's password and all of the data protected by that
password.
OAuth addresses these issues by introducing an authorization layer OAuth addresses these issues by introducing an authorization layer
and separating the role of the client from that of the resource and separating the role of the client from that of the resource
owner. In OAuth, the client requests access to resources controlled owner. In OAuth, the client requests access to resources controlled
by the resource owner and hosted by the resource server, and is by the resource owner and hosted by the resource server, and is
issued a different set of credentials than those of the resource issued a different set of credentials than those of the resource
owner. owner.
Instead of using the resource owner's credentials to access protected Instead of using the resource owner's credentials to access protected
resources, the client obtains an access token - a string denoting a resources, the client obtains an access token - a string denoting a
specific scope, duration, and other access attributes. Access tokens specific scope, duration, and other access attributes. Access tokens
are issued to third-party clients by an authorization server with the are issued to third-party clients by an authorization server with the
approval of the resource owner. The client uses the access token to approval of the resource owner. The client uses the access token to
access the protected resources hosted by the resource server. access the protected resources hosted by the resource server.
For example, a web end-user (resource owner) can grant a printing For example, an end-user (resource owner) can grant a printing
service (client) access to her protected photos stored at a photo service (client) access to her protected photos stored at a photo
sharing service (resource server), without sharing her username and sharing service (resource server), without sharing her username and
password with the printing service. Instead, she authenticates password with the printing service. Instead, she authenticates
directly with a server trusted by the photo sharing service directly with a server trusted by the photo sharing service
(authorization server) which issues the printing service delegation- (authorization server) which issues the printing service delegation-
specific credentials (access token). specific credentials (access token).
This specification is designed for use with HTTP [RFC2616]. The use This specification is designed for use with HTTP [RFC2616]. The use
of OAuth with any transport protocol other than HTTP is undefined. of OAuth with any transport protocol other than HTTP is undefined.
1.1. Roles 1.1. Roles
OAuth includes four roles working together to grant and provide OAuth includes four roles working together to grant and provide
access to protected resources - access restricted resources which access to protected resources - access restricted resources requiring
require authentication to access: authentication:
resource owner resource owner
An entity capable of granting access to a protected resource. An entity capable of granting access to a protected resource (e.g.
When the resource owner is a person, it is referred to as an end- end-user).
user.
resource server resource server
The server hosting the protected resources, capable of accepting The server hosting the protected resources, capable of accepting
and responding to protected resource requests using access tokens. and responding to protected resource requests using access tokens.
client client
An application making protected resource requests on behalf of the An application making protected resource requests on behalf of the
resource owner and with its authorization. resource owner and with its authorization.
authorization server authorization server
The server issuing access tokens to the client after successfully The server issuing access tokens to the client after successfully
authenticating the resource owner and obtaining authorization. authenticating the resource owner and obtaining authorization.
The interaction between the authorization server and resource server The interaction between the authorization server and resource server
is beyond the scope of this specification. The authorization server is beyond the scope of this specification. The authorization server
may be the same server as the resource server or a separate entity. may be the same server as the resource server or a separate entity.
A single authorization server may issue access tokens accepted by A single authorization server may issue access tokens accepted by
multiple resource servers. multiple resource servers.
1.2. Protocol Flow 1.2. Protocol Flow
When interacting with the authorization server, the client identifies
itself using a set of client credentials which include a client
identifier and other authentication attributes. The means through
which the client obtains its credentials are beyond the scope of this
specification, but typically involve registration with the
authorization server.
+--------+ +---------------+ +--------+ +---------------+
| |--(A)- Authorization Request ->| Resource | | |--(A)- Authorization Request ->| Resource |
| | | Owner | | | | Owner |
| |<-(B)-- Authorization Grant ---| | | |<-(B)-- Authorization Grant ---| |
| | +---------------+ | | +---------------+
| | | |
| | Authorization Grant & +---------------+ | | +---------------+
| |--(C)--- Client Credentials -->| Authorization | | |--(C)-- Authorization Grant -->| Authorization |
| Client | | Server | | Client | | Server |
| |<-(D)----- Access Token -------| | | |<-(D)----- Access Token -------| |
| | +---------------+ | | +---------------+
| | | |
| | +---------------+ | | +---------------+
| |--(E)----- Access Token ------>| Resource | | |--(E)----- Access Token ------>| Resource |
| | | Server | | | | Server |
| |<-(F)--- Protected Resource ---| | | |<-(F)--- Protected Resource ---| |
+--------+ +---------------+ +--------+ +---------------+
Figure 1: Abstract Protocol Flow Figure 1: Abstract Protocol Flow
The abstract flow illustrated in Figure 1 describes the interaction The abstract flow illustrated in Figure 1 describes the interaction
between the four roles and includes the following steps: between the four roles and includes the following steps:
(A) The client requests authorization from the resource owner. The (A) The client requests authorization from the resource owner. The
authorization request can be made directly to the resource owner authorization request can be made directly to the resource owner
(as shown), or preferably indirectly via an intermediary such as (as shown), or preferably indirectly via an intermediary such as
an authorization server. an authorization server.
(B) The client receives an authorization grant which represents the (B) The client receives an authorization grant which represents the
skipping to change at page 6, line 37 skipping to change at page 7, line 18
(A) The client requests authorization from the resource owner. The (A) The client requests authorization from the resource owner. The
authorization request can be made directly to the resource owner authorization request can be made directly to the resource owner
(as shown), or preferably indirectly via an intermediary such as (as shown), or preferably indirectly via an intermediary such as
an authorization server. an authorization server.
(B) The client receives an authorization grant which represents the (B) The client receives an authorization grant which represents the
authorization provided by the resource owner. The authorization authorization provided by the resource owner. The authorization
grant type depends on the method used by the client and grant type depends on the method used by the client and
supported by the authorization server to obtain it. supported by the authorization server to obtain it.
(C) The client requests an access token by authenticating with the (C) The client requests an access token by authenticating with the
authorization server using its client credentials (prearranged authorization server and presenting the authorization grant.
between the client and authorization server) and presenting the (D) The authorization server authenticates the client and validates
authorization grant.
(D) The authorization server validates the client credentials and
the authorization grant, and if valid issues an access token. the authorization grant, and if valid issues an access token.
(E) The client requests the protected resource from the resource (E) The client requests the protected resource from the resource
server and authenticates by presenting the access token. server and authenticates by presenting the access token.
(F) The resource server validates the access token, and if valid, (F) The resource server validates the access token, and if valid,
serves the request. serves the request.
1.3. Access Token 1.3. Access Token
An access token is a string representing an authorization issued to Access tokens are credentials used to access protected resources. An
the client. The string is usually opaque to the client. Tokens access token is a string representing an authorization issued to the
client. The string is usually opaque to the client. Tokens
represent specific scopes and durations of access, granted by the represent specific scopes and durations of access, granted by the
resource owner, and enforced by the resource server and authorization resource owner, and enforced by the resource server and authorization
server. server.
The token may denote an identifier used to retrieve the authorization The token may denote an identifier used to retrieve the authorization
information, or self-contain the authorization information in a information, or self-contain the authorization information in a
verifiable manner (i.e. a token string consisting of some data and a verifiable manner (i.e. a token string consisting of some data and a
signature). Additional authentication credentials may be required in signature). Additional authentication credentials, which are beyond
order for the client to use a token. the scope of this specification, may be required in order for the
client to use a token.
The access token provides an abstraction layer, replacing different The access token provides an abstraction layer, replacing different
authorization constructs (e.g. username and password) with a single authorization constructs (e.g. username and password) with a single
token understood by the resource server. This abstraction enables token understood by the resource server. This abstraction enables
issuing access tokens more restrictive than the authorization grant issuing access tokens more restrictive than the authorization grant
used to obtain them, as well as removing the resource server's need used to obtain them, as well as removing the resource server's need
to understand a wide range of authentication methods. to understand a wide range of authentication methods.
Access tokens can have different formats, structures, and methods of Access tokens can have different formats, structures, and methods of
utilization (e.g. cryptographic properties) based on the resource utilization (e.g. cryptographic properties) based on the resource
skipping to change at page 8, line 13 skipping to change at page 8, line 42
only authenticates with the authorization server, the resource only authenticates with the authorization server, the resource
owner's credentials are never shared with the client. owner's credentials are never shared with the client.
The authorization code provides a few important security benefits The authorization code provides a few important security benefits
such as the ability to authenticate the client and issuing the access such as the ability to authenticate the client and issuing the access
token directly to the client without potentially exposing it to token directly to the client without potentially exposing it to
others, including the resource owner. others, including the resource owner.
1.4.2. Implicit 1.4.2. Implicit
When an access token is issued to the client directly as the result The authorization grant is implicit when an access token is issued to
of the resource owner authorization, without an intermediary the client directly as the result of the resource owner
authorization grant (such as an authorization code), the grant is authorization, without using intermediate credentials (such as an
considered implicit. authorization code).
When issuing an implicit grant, the authorization server cannot When issuing an implicit grant, the authorization server does not
verify the identity of the client, and the access token may be authenticate the client and the client identity is verified via the
exposed to the resource owner or other applications with access to redirection URI used to deliver the access token to the client. The
the resource owner's user-agent. access token may be exposed to the resource owner or other
applications with access to the resource owner's user-agent.
Implicit grants improve the responsiveness and efficiency of some Implicit grants improve the responsiveness and efficiency of some
clients (such as a client implemented as an in-browser application) clients (such as a client implemented as an in-browser application)
since it reduces the number of round trips required to obtain an since it reduces the number of round trips required to obtain an
access token. access token. However, this convenience should be weighted against
the security implications of using implicit grants, especially when
the authorization code grant type is available.
1.4.3. Resource Owner Password Credentials 1.4.3. Resource Owner Password Credentials
The resource owner password credentials (e.g. a username and The resource owner password credentials (e.g. a username and
password) can be used directly as an authorization grant to obtain an password) can be used directly as an authorization grant to obtain an
access token. The credentials should only be used when there is a access token. The credentials should only be used when there is a
high degree of trust between the resource owner and the client (e.g. high degree of trust between the resource owner and the client (e.g.
its computer operating system or a highly privileged application), its computer operating system or a highly privileged application),
and when other authorization grant types are not available (such as and when other authorization grant types are not available (such as
an authorization code). an authorization code).
Even though this grant type requires direct client access to the Even though this grant type requires direct client access to the
resource owner credentials, the resource owner credentials are used resource owner credentials, the resource owner credentials are used
for a single request and are exchanged for an access token. Unlike for a single request and are exchanged for an access token. Unlike
the HTTP Basic authentication scheme defined in [RFC2617], this grant the HTTP Basic authentication scheme defined in [RFC2617], this grant
type (when combined with a refresh token) eliminates the need for the type (when combined with a refresh token) eliminates the need for the
client to store the resource-owner credentials for future use. client to store the resource owner credentials for future use.
1.4.4. Client Credentials 1.4.4. Client Credentials
The client credentials can be used as an authorization grant when the The client credentials (or other forms of client authentication) can
authorization scope is limited to the protected resources under the be used as an authorization grant when the authorization scope is
control of the client, or to protected resources previously arranged limited to the protected resources under the control of the client,
with the authorization server. Client credentials are used as an or to protected resources previously arranged with the authorization
authorization grant typically when the client is acting on its own server. Client credentials are used as an authorization grant
behalf (the client is also the resource owner). typically when the client is acting on its own behalf (the client is
also the resource owner).
1.4.5. Extensions 1.4.5. Extensions
Additional grant types may be defined to provide a bridge between Additional grant types may be defined to provide a bridge between
OAuth and other protocols. For example, OAuth and other protocols.
[I-D.ietf-oauth-saml2-bearer] defines a SAML 2.0
[OASIS.saml-core-2.0-os] bearer assertion grant type, which can be
used to obtain an access token.
1.5. Refresh Token 1.5. Refresh Token
A refresh token is optionally issued by the authorization server to Refresh tokens are credentials used to obtain access tokens. Refresh
the client together with an access token. The client can use the tokens are issued to the client by the authorization server and are
refresh token to request another access token based on the same used to obtain a new access token when the current access token
authorization, without having to involve the resource owner again, or becomes invalid or expires, or to obtain additional access tokens
having to retain the original authorization grant used to obtain the with identical or narrower scope (access tokens may have a shorter
initial access token. lifetime and fewer permissions than authorized by the resource
owner). Issuing a refresh token is optional and is included when
issuing an access token.
A refresh token is a string representing the authorization granted to A refresh token is a string representing the authorization granted to
the client by the resource owner. The string is usually opaque to the client by the resource owner. The string is usually opaque to
the client. The token may denote an identifier used to retrieve the the client. The token denotes an identifier used to retrieve the
authorization information, or self-contain the authorization authorization information. Unlike access tokens, refresh tokens are
information in a verifiable manner. The refresh token is bound to intended for use only with authorization servers and are never sent
the client it was issued to, and its usage requires client to resource servers.
authentication.
The refresh token can be used to obtain a new access token when the
current access token expires (access tokens may have a shorter
lifetime than authorized by the resource owner), no longer valid, or
to obtain additional access tokens with identical or narrower scope.
+--------+ Authorization Grant & +---------------+ +--------+ +---------------+
| |--(A)-------- Client Credentials --------->| | | |--(A)------- Authorization Grant --------->| |
| | | | | | | |
| |<-(B)----------- Access Token -------------| | | |<-(B)----------- Access Token -------------| |
| | & Refresh Token | | | | & Refresh Token | |
| | | | | | | |
| | +----------+ | | | | +----------+ | |
| |--(C)---- Access Token ---->| | | | | |--(C)---- Access Token ---->| | | |
| | | | | | | | | | | |
| |<-(D)- Protected Resource --| Resource | | Authorization | | |<-(D)- Protected Resource --| Resource | | Authorization |
| Client | | Server | | Server | | Client | | Server | | Server |
| |--(E)---- Access Token ---->| | | | | |--(E)---- Access Token ---->| | | |
| | | | | | | | | | | |
| |<-(F)- Invalid Token Error -| | | | | |<-(F)- Invalid Token Error -| | | |
| | +----------+ | | | | +----------+ | |
| | | | | | | |
| | Refresh Token & | | | |--(G)----------- Refresh Token ----------->| |
| |--(G)-------- Client Credentials --------->| |
| | | | | | | |
| |<-(H)----------- Access Token -------------| | | |<-(H)----------- Access Token -------------| |
+--------+ & Optional Refresh Token +---------------+ +--------+ & Optional Refresh Token +---------------+
Figure 2: Refreshing an Expired Access Token Figure 2: Refreshing an Expired Access Token
The flow illustrated in Figure 2 includes the following steps: The flow illustrated in Figure 2 includes the following steps:
(A) The client requests an access token by authenticating with the (A) The client requests an access token by authenticating with the
authorization server using its client credentials, and authorization server, and presenting an authorization grant.
presenting an authorization grant. (B) The authorization server authenticates the client and validates
(B) The authorization server validates the client credentials and
the authorization grant, and if valid issues an access token and the authorization grant, and if valid issues an access token and
a refresh token. a refresh token.
(C) The client makes a protected resource requests to the resource (C) The client makes a protected resource requests to the resource
server by presenting the access token. server by presenting the access token.
(D) The resource server validates the access token, and if valid, (D) The resource server validates the access token, and if valid,
serves the request. serves the request.
(E) Steps (C) and (D) repeat until the access token expires. If the (E) Steps (C) and (D) repeat until the access token expires. If the
client knows the access token expired, it skips to step (G), client knows the access token expired, it skips to step (G),
otherwise it makes another protected resource request. otherwise it makes another protected resource request.
(F) Since the access token is invalid, the resource server returns (F) Since the access token is invalid, the resource server returns
an invalid token error. an invalid token error.
(G) The client requests a new access token by authenticating with (G) The client requests a new access token by authenticating with
the authorization server using its client credentials, and the authorization server and presenting the refresh token.
presenting the refresh token. (H) The authorization server authenticates the client and validates
(H) The authorization server validates the client credentials and
the refresh token, and if valid issues a new access token (and the refresh token, and if valid issues a new access token (and
optionally, a new refresh token). optionally, a new refresh token).
1.6. Document Structure 1.6. Notational Conventions
This specification is organized into the following sections:
o Section 2 - describes the two endpoints used to obtain and utilize
the various authorization grant types.
o Section 3 - describes client identification and authentication in
general, and provides one such method for client authentication
using password credentials.
o Section 4 - describes the complete flow for each authorization
grant type, including requesting authorization, authorization
response, and requesting an access token.
o Section 5 - describes the common access token response used for
all non-implicit authorization grant types.
o Section 6 - describes the use of a refresh token to obtain
additional access tokens using the same resource owner
authorization.
o Section 7 - describes how access tokens are used to access
protected resources.
o Section 8 - describes how to extend certain elements of the
protocol.
o Section 9 - provides a security analysis of the protocol.
1.7. Notational Conventions
The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL NOT', The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL NOT',
'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'MAY', and 'OPTIONAL' in this 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'MAY', and 'OPTIONAL' in this
specification are to be interpreted as described in [RFC2119]. specification are to be interpreted as described in [RFC2119].
This specification uses the Augmented Backus-Naur Form (ABNF) This specification uses the Augmented Backus-Naur Form (ABNF)
notation of [RFC5234]. notation of [RFC5234].
Certain security-related terms are to be understood in the sense
defined in [RFC4949]. These terms include, but are not limited to,
'attack', 'authentication', 'authorization', 'certificate',
'confidentiality', 'credential', 'encryption', 'identity', 'sign',
'signature', 'trust', 'validate', and 'verify'.
Unless otherwise noted, all the protocol parameter names and values Unless otherwise noted, all the protocol parameter names and values
are case sensitive. are case sensitive.
2. Protocol Endpoints 2. Client Registration
[[ Pending Consensus ]]
Before initiating the protocol, the client registers with the
authorization server. The means through which the client registers
with the authorization server are beyond the scope of this
specification, but typically involve human interaction with an HTML
registration form.
Client registration does not require a direct interaction between the
client and the authorization server. When supported by the
authorization server, registration can rely on other means for
establishing trust and obtaining the required client properties (e.g.
redirection URI, client type). For example, registration can be
accomplished using a self-issued or third-party-issued assertion, or
by the authorization server performing client discovery using a
trusted channel.
2.1. Client Types
OAuth defines two client types, based on their ability to
authenticate securely with the authorization server (i.e. ability to
maintain the confidentiality of their client credentials):
private
Clients capable of maintaining the confidentiality of their
credentials (e.g. client implemented on a secure server with
restricted access to the client credentials), or capable of secure
client authentication using other means.
public
Clients incapable of maintaining the confidentiality of their
credentials (e.g. clients executing on the resource owner's device
such as an installed native application or a user-agent-based
application), and incapable of secure client authentication via
any other mean.
The client type designation is based on the authorization server's
definition of secure authentication and its acceptable exposure
levels of client credentials.
2.2. Registration Requirements
When registering a client, the client developer MUST specify:
o the client type as described in Section 2.1,
o the client redirection URIs as described in Section 3.1.2, and
o any other information required by the authorization server (e.g.
application name, website, description, logo image, the acceptance
of legal terms).
2.3. Client Identifier
The authorization server issues the registered client a client
identifier - a unique string representing the registration
information provided by the client. The client identifier is not a
secret, it is exposed to the resource owner, and cannot not be used
alone for client authentication.
2.4. Client Authentication
In addition, the client and authorization server establish a client
authentication method suitable for the client type and security
requirements of the authorization server. The authorization server
MAY accept any form of client authentication meeting its security
requirements.
Private clients are typically issued (or establish) a set of client
credentials used for authenticating with the authorization server
(e.g. password, public/private key pair).
The authorization server SHOULD NOT make assumptions about the client
type or accept the type information provided without establishing
trust with the client or its developer. The authorization server
MUST NOT rely on client authentication performed by public clients.
The client MUST NOT use more than one authentication method in each
request.
2.4.1. Client Password
Clients in possession of a client password MAY use the HTTP Basic
authentication scheme as defined in [RFC2617] to authenticate with
the authorization server. The client identifier is used as the
username, and the client password is used as the password.
For example (extra line breaks are for display purposes only):
Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
Alternatively, the authorization server MAY allow including the
client credentials in the request body using the following
parameters:
client_id
REQUIRED. The client identifier issued to the client during
the registration process described by Section 2.3.
client_secret
REQUIRED. The client secret.
Including the client credentials in the request body using the two
parameters is NOT RECOMMENDED, and should be limited to clients
unable to directly utilize the HTTP Basic authentication scheme (or
other password-based HTTP authentication schemes).
For example, requesting to refresh an access token (Section 6) using
the body parameters (extra line breaks are for display purposes
only):
POST /token HTTP/1.1
Host: server.example.com
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
grant_type=refresh_token&refresh_token=tGzv3JOkF0XG5Qx2TlKWIA
&client_id=s6BhdRkqt3&client_secret=7Fjfp0ZBr1KtDRbnfVdmIw
The authorization server MUST require the use of a transport-layer
security mechanism when sending requests to the token endpoint, as
requests using this authentication method result in the transmission
of clear-text credentials.
2.4.2. Other Authentication Methods
The authorization server MAY support any suitable HTTP authentication
scheme matching its security requirements. When using other
authentication methods, the authorization server MUST define a
mapping between the client identifier (registration record) and
authentication scheme.
2.5. Unregistered Clients
This specification does not exclude the use of unregistered clients.
However, the use with such clients is beyond the scope of this
specification, and requires additional security analysis and review
of its interoperability impact.
3. Protocol Endpoints
The authorization process utilizes two endpoints (HTTP resources): The authorization process utilizes two endpoints (HTTP resources):
o Authorization endpoint - used to obtain authorization from the o Authorization endpoint - used to obtain authorization from the
resource owner via user-agent redirection. resource owner via user-agent redirection.
o Token endpoint - used to exchange an authorization grant for an o Token endpoint - used to exchange an authorization grant for an
access token, typically with client authentication. access token, typically with client authentication.
Not every authorization grant type utilizes both endpoints. Not every authorization grant type utilizes both endpoints.
Extension grant types MAY define additional endpoints as needed. Extension grant types MAY define additional endpoints as needed.
2.1. Authorization Endpoint 3.1. Authorization Endpoint
The authorization endpoint is used to interact with the resource The authorization endpoint is used to interact with the resource
owner and obtain authorization which is expressed explicitly as an owner and obtain authorization which is expressed explicitly as an
authorization code (exchanged for an access token), or implicitly by authorization code (later exchanged for an access token), or
direct issuance of an access token. implicitly by direct issuance of an access token.
The authorization server MUST first verify the identity of the The authorization server MUST first verify the identity of the
resource owner. The way in which the authorization server resource owner. The way in which the authorization server
authenticates the resource owner (e.g. username and password login, authenticates the resource owner (e.g. username and password login,
session cookies) is beyond the scope of this specification. session cookies) is beyond the scope of this specification.
The means through which the client obtains the location of the The means through which the client obtains the location of the
authorization endpoint are beyond the scope of this specification but authorization endpoint are beyond the scope of this specification but
is typically provided in the service documentation. The endpoint URI the location is typically provided in the service documentation. The
MAY include a query component as defined by [RFC3986] section 3, endpoint URI MAY include a query component as defined by [RFC3986]
which MUST be retained when adding additional query parameters. section 3, which MUST be retained when adding additional query
parameters. The endpoint URI MUST NOT include a fragment component.
Since requests to the authorization endpoint result in user Since requests to the authorization endpoint result in user
authentication and the transmission of clear-text credentials (in the authentication and the transmission of clear-text credentials (in the
HTTP response), the authorization server MUST require the use of a HTTP response), the authorization server MUST require the use of a
transport-layer security mechanism when sending requests to the transport-layer security mechanism when sending requests to the
authorization endpoint. The authorization server MUST support TLS authorization endpoint. The authorization server MUST support TLS
1.2 as defined in [RFC5246], and MAY support additional transport- 1.2 as defined in [RFC5246], and MAY support additional transport-
layer mechanisms meeting its security requirements. layer mechanisms meeting its security requirements.
The authorization server MUST support the use of the HTTP "GET" The authorization server MUST support the use of the HTTP "GET"
method [RFC2616] for the authorization endpoint, and MAY support the method [RFC2616] for the authorization endpoint, and MAY support the
use of the "POST" method as well. use of the "POST" method as well.
The REQUIRED "response_type" request parameter is used to identify
which grant type the client is requesting: authorization code or
implicit, described in Section 4.1.1 and Section 4.2.1 respectively.
If the request is missing the "response_type" parameter, the
authorization server SHOULD return an error response as described in
Section 4.1.2.1.
Parameters sent without a value MUST be treated as if they were Parameters sent without a value MUST be treated as if they were
omitted from the request. The authorization server SHOULD ignore omitted from the request. The authorization server SHOULD ignore
unrecognized request parameters. unrecognized request parameters. Request and response parameters
MUST NOT be included more than once.
Request and response parameters MUST NOT repeat more than once, 3.1.1. Response Type
unless noted otherwise.
2.1.1. Redirection URI The authorization endpoint is used by the authorization code grant
type and implicit grant type flows. The client informs the
authorization server of the desired grant type using the following
parameter:
The client directs the resource owner's user-agent to the response_type
authorization endpoint and includes a redirection URI to which the REQUIRED. The value MUST be one of "code" for requesting an
authorization server will redirect the user-agent back once authorization code as described by Section 4.1.1, "token" for
authorization has been obtained (or denied). The client MAY omit the requesting an access token (implicit grant) as described by
redirection URI if one has been established between the client and Section 4.2.1, or a registered extension value as described by
authorization server via other means, such as during the client Section 8.4.
registration process.
The redirection URI MUST be an absolute URI and MAY include a query If an authorization request is missing the "response_type" parameter,
component, which MUST be retained by the authorization server when the authorization server SHOULD return an error response as described
adding additional query parameters. in Section 4.1.2.1.
The authorization server SHOULD require the client to pre-register 3.1.2. Redirection URI
their redirection URI or at least certain components such as the
scheme, host, port and path. If a redirection URI was registered, [[ Pending Consensus ]]
the authorization server MUST compare any redirection URI received at
the authorization endpoint with the registered URI. After completing its interaction with the resource owner, the
authorization server directs the resource owner's user-agent back to
the client. The authorization server redirects the user-agent to the
client's redirection URI previously established with the
authorization server during the client registration process.
The redirection URI MUST be an absolute URI as defined by [RFC3986]
section 4.3, MAY include a query component which MUST be retained by
the authorization server when adding additional query parameters, and
MUST NOT include a fragment component.
3.1.2.1. Endpoint Confidentiality
If a redirection request will result in the transmission of an
authorization code or access token over an open network (between the
resource owner's user-agent and the client), the client SHOULD
require the use of a transport-layer security mechanism.
Lack of transport-layer security can have a severe impact on the
security of the client and the protected resources it is authorized
to access. The use of transport-layer security is particularly
critical when the authorization process is used as a form of
delegated end-user authentication by the client (e.g. third-party
sign-in service).
3.1.2.2. Registration Requirements
The authorization server MUST require public clients to register
their redirection URI, MUST require all clients to register their
redirection URI prior to utilizing the implicit grant type, and
SHOULD require all clients to register their redirection URI prior to
utilizing the authorization code grant type.
The authorization server SHOULD require the client to provide the
complete redirection URI (the client MAY use the "state" request
parameter to achieve per-request customization). The authorization
server MAY allow the client to register multiple redirection URIs.
If requiring the registration of the complete redirection URI is not
possible, the authorization server SHOULD require the registration of
the URI scheme, authority, and path.
3.1.2.3. Dynamic Configuration
If multiple redirection URIs have been registered, if only part of
the redirection URI has been registered, or if no redirection URI has
been registered, the client MUST include a redirection URI with the
authorization request using the "redirect_uri" request parameter.
When a redirection URI is included in an authorization request, the
authorization server MUST compare and match the value received
against at least one of the registered redirection URIs (or URI
components) as defined in [RFC3986] section 6, if any redirection
URIs were registered.
If the authorization server allows the client to dynamically change
the query component of the redirection URI, the client MUST ensure
that manipulation of the query component by an attacker cannot lead
to an abuse of the redirection endpoint as an open redirector.
3.1.2.4. Invalid Endpoint
If an authorization request fails validation due to a missing,
invalid, or mismatching redirection URI, the authorization server
SHOULD inform the resource owner of the error, and MUST NOT
automatically redirect the user-agent to the invalid redirection URI.
The authorization server SHOULD NOT redirect the user-agent to The authorization server SHOULD NOT redirect the user-agent to
unregistered or untrusted URIs to prevent the endpoint from being unregistered or untrusted URIs to prevent the authorization endpoint
used as an open redirector. If no valid redirection URI is from being used as an open redirector.
available, the authorization server SHOULD inform the resource owner
directly of the error.
2.2. Token Endpoint 3.1.2.5. Endpoint Content
The redirection request to the client's endpoint typically results in
an HTML document response, processed by the user-agent. If the HTML
response is served directly as the result of the redirection request,
any script included in the HTML document will execute with full
access to the redirection URI and the credentials it contains.
The client SHOULD NOT include any third-party scripts in the
redirection endpoint response. Instead, it should extract the
credentials from the URI and redirect the user-agent again to another
endpoint without the credentials in the URI.
The client MUST NOT include any untrusted third-party scripts in the
redirection endpoint response (e.g. third-party analytics, social
plug-ins, ad networks) without first ensuring that its own scripts
used to extract and remove the credentials from the URI will execute
first.
3.2. Token Endpoint
The token endpoint is used by the client to obtain an access token by The token endpoint is used by the client to obtain an access token by
authenticating with the authorization server and presenting its presenting its authorization grant or refresh token. The token
authorization grant or refresh token. The token endpoint is used endpoint is used with every authorization grant except for the
with every authorization grant except for the implicit grant type implicit grant type (since an access token is issued directly).
(since an access token is issued directly).
The means through which the client obtains the location of the token The means through which the client obtains the location of the token
endpoint are beyond the scope of this specification but is typically endpoint are beyond the scope of this specification but is typically
provided in the service documentation. The endpoint URI MAY include provided in the service documentation. The endpoint URI MAY include
a query component, which MUST be retained when adding additional a query component, which MUST be retained when adding additional
query parameters. query parameters.
Since requests to the token endpoint result in the transmission of Since requests to the token endpoint result in the transmission of
clear-text credentials (in the HTTP request and response), the clear-text credentials (in the HTTP request and response), the
authorization server MUST require the use of a transport-layer authorization server MUST require the use of a transport-layer
security mechanism when sending requests to the token endpoint. The security mechanism when sending requests to the token endpoint. The
authorization server MUST support TLS 1.2 as defined in [RFC5246], authorization server MUST support TLS 1.2 as defined in [RFC5246],
and MAY support additional transport-layer mechanisms meeting its and MAY support additional transport-layer mechanisms meeting its
security requirements. security requirements.
The token endpoint requires client authentication as described in
Section 3. The authorization server MAY accept any form of client
authentication meeting its security requirements. The client MUST
NOT use more than one authentication method in each request.
The client MUST use the HTTP "POST" method when making access token The client MUST use the HTTP "POST" method when making access token
requests. requests.
Parameters sent without a value MUST be treated as if they were Parameters sent without a value MUST be treated as if they were
omitted from the request. The authorization server SHOULD ignore omitted from the request. The authorization server SHOULD ignore
unrecognized request parameters. unrecognized request parameters. Request and response parameters
MUST NOT be included more than once.
Request and response parameters MUST NOT repeat more than once,
unless noted otherwise.
3. Client Authentication
Client credentials are used to identify and authenticate the client.
The client credentials include a client identifier - a unique string
issued to the client to identify itself to the authorization server.
The client identifier is not a secret, it is exposed to the resource
owner, and MUST NOT be used alone for client authentication. Client
authentication is accomplished via additional means such as a
matching client password.
The methods through which the client obtains its client credentials
are beyond the scope of this specification. However, the client
registration process typically includes gathering relevant
information which is used to educate the resource owner about the
client when requesting authorization.
Due to the nature of some clients, the authorization server should
not make assumptions about the confidentiality of client credentials
without establishing trust with the client. The authorization server
SHOULD NOT issue client credentials to clients incapable of keeping
their credentials confidential (typically determined during the
client registration process).
In addition, the authorization server MAY allow unauthenticated
access token requests when the client identity does not matter (e.g.
anonymous client) or when the client identity is established via
other means. For readability purposes only, this specification is
written under the assumption that the authorization server requires
some form of client authentication. However, such language does not
affect the authorization server's discretion in allowing
unauthenticated client requests.
3.1. Client Password Authentication 3.2.1. Client Authentication
[[ Pending Consensus ]] [[ Pending Consensus ]]
Clients in possession of client password credentials (the client Private clients, clients issued client credentials, or clients
identifier together with a shared symmetric secret) MAY use the HTTP assigned other authentication requirements, MUST authenticate with
Basic authentication scheme as defined in [RFC2617] to authenticate the authorization server as described in Section 2.4 when making
with the authorization server. The client identifier is used as the requests to the token endpoint. Client authentication is used for:
username, and the secret is used as the password.
When using the HTTP Basic authentication scheme, the client
identifier is included twice in the request (in the "Authorization"
header and in the "client_id" parameter). The authorization server
MUST ensure the two identifiers belong to the same client.
For example (extra line breaks are for display purposes only):
POST /token HTTP/1.1
Host: server.example.com
Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code&client_id=s6BhdRkqt3&
code=i1WsRn1uB1&
redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb
Alternatively, the authorization server MAY allow including the
client secret in the request body using the following parameter:
client_secret
REQUIRED. The client secret.
The use of the "client_secret" parameter is NOT RECOMMENDED, and
should be limited to clients unable to directly utilize the HTTP
Basic authentication scheme.
For example (extra line breaks are for display purposes only):
POST /token HTTP/1.1
Host: server.example.com
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code&client_id=s6BhdRkqt3&
client_secret=gX1fBat3bV&code=i1WsRn1uB1&
redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb
Since requests using this authentication method result in the o Enforcing the binding of refresh tokens and authorization codes to
transmission of clear-text credentials, the authorization server MUST the client they are issued. Client authentication is critical
require the use of a transport-layer security mechanism when sending when an authorization code is transmitted to the redirection URI
requests to the token endpoint. endpoint over an insecure channel, or when the redirection URI has
not been registered in full.
o Recovery from a compromised client by disabling the client or
changing its credentials, by preventing an attacker from abusing
stolen refresh tokens. Changing a single set of client
credentials is significantly faster than revoking an entire set of
refresh tokens.
3.2. Other Client Authentication Methods o Implementing authentication management best practices which
require periodic credentials rotation. Rotation of an entire set
of refresh tokens can be challenging, while rotation of a single
set of client credentials is significantly easier. In addition,
this specification does not provide a mechanism for refresh token
rotation.
The authorization server MAY support any suitable HTTP authentication The security ramifications of allowing unauthenticated access by
scheme matching its security requirements. When using other public clients to the token endpoint MUST be considered, as well as
authentication methods, the authorization server MUST define a the issuance of refresh tokens to public clients, their scope, and
mapping between the client identifier and the credentials used to lifetime.
authenticate.
4. Obtaining Authorization 4. Obtaining Authorization
To request an access token, the client obtains authorization from the To request an access token, the client obtains authorization from the
resource owner. The authorization is expressed in the form of an resource owner. The authorization is expressed in the form of an
authorization grant which the client uses to request the access authorization grant which the client uses to request the access
token. OAuth defines four grant types: authorization code, implicit, token. OAuth defines four grant types: authorization code, implicit,
resource owner password credentials, and client credentials. It also resource owner password credentials, and client credentials. It also
provides an extension mechanism for defining additional grant types. provides an extension mechanism for defining additional grant types.
4.1. Authorization Code 4.1. Authorization Code
The authorization code grant type is suitable for clients capable of The authorization code grant type is used to obtain both access
maintaining their client credentials confidential (for authenticating tokens and refresh tokens and is optimized for private clients. As a
with the authorization server) such as a client implemented on a redirection-based flow, the client must be capable of interacting
secure server. As a redirection-based flow, the client must be with the resource owner's user-agent (typically a web browser) and
capable of interacting with the resource owner's user-agent capable of receiving incoming requests (via redirection) from the
(typically a web browser) and capable of receiving incoming requests authorization server.
(via redirection) from the authorization server.
+----------+ +----------+
| resource | | resource |
| owner | | owner |
| | | |
+----------+ +----------+
^ ^
| |
(B) (B)
+----|-----+ Client Identifier +---------------+ +----|-----+ Client Identifier +---------------+
| -+----(A)--- & Redirect URI ------>| | | -+----(A)-- & Redirection URI ---->| |
| User- | | Authorization | | User- | | Authorization |
| Agent -+----(B)-- User authenticates --->| Server | | Agent -+----(B)-- User authenticates --->| Server |
| | | | | | | |
| -+----(C)-- Authorization Code ---<| | | -+----(C)-- Authorization Code ---<| |
+-|----|---+ +---------------+ +-|----|---+ +---------------+
| | ^ v | | ^ v
(A) (C) | | (A) (C) | |
| | | | | | | |
^ v | | ^ v | |
+---------+ | | +---------+ | |
| |>---(D)-- Client Credentials, --------' | | |>---(D)-- Authorization Code ---------' |
| | Authorization Code, | | Client | & Redirection URI |
| Client | & Redirect URI |
| | | | | |
| |<---(E)----- Access Token -------------------' | |<---(E)----- Access Token -------------------'
+---------+ (w/ Optional Refresh Token) +---------+ (w/ Optional Refresh Token)
Figure 3: Authorization Code Flow Figure 3: Authorization Code Flow
The flow illustrated in Figure 3 includes the following steps: The flow illustrated in Figure 3 includes the following steps:
(A) The client initiates the flow by directing the resource owner's (A) The client initiates the flow by directing the resource owner's
user-agent to the authorization endpoint. The client includes user-agent to the authorization endpoint. The client includes
skipping to change at page 18, line 6 skipping to change at page 21, line 6
(B) The authorization server authenticates the resource owner (via (B) The authorization server authenticates the resource owner (via
the user-agent) and establishes whether the resource owner the user-agent) and establishes whether the resource owner
grants or denies the client's access request. grants or denies the client's access request.
(C) Assuming the resource owner grants access, the authorization (C) Assuming the resource owner grants access, the authorization
server redirects the user-agent back to the client using the server redirects the user-agent back to the client using the
redirection URI provided earlier. The redirection URI includes redirection URI provided earlier. The redirection URI includes
an authorization code and any local state provided by the client an authorization code and any local state provided by the client
earlier. earlier.
(D) The client requests an access token from the authorization (D) The client requests an access token from the authorization
server's token endpoint by authenticating using its client server's token endpoint by including the authorization code
credentials, and includes the authorization code received in the received in the previous step. When making the request, the
previous step. The client includes the redirection URI used to client authenticates with the authorization server. The client
obtain the authorization code for verification. includes the redirection URI used to obtain the authorization
(E) The authorization server validates the client credentials, the code for verification.
(E) The authorization server authenticates the client, validates the
authorization code, and ensures the redirection URI received authorization code, and ensures the redirection URI received
matches the URI used to redirect the client in step (C). If matches the URI used to redirect the client in step (C). If
valid, responds back with an access token. valid, responds back with an access token.
4.1.1. Authorization Request 4.1.1. Authorization Request
The client constructs the request URI by adding the following The client constructs the request URI by adding the following
parameters to the query component of the authorization endpoint URI parameters to the query component of the authorization endpoint URI
using the "application/x-www-form-urlencoded" format as defined by using the "application/x-www-form-urlencoded" format as defined by
[W3C.REC-html401-19991224]: [W3C.REC-html401-19991224]:
response_type response_type
REQUIRED. Value MUST be set to "code". REQUIRED. Value MUST be set to "code".
client_id client_id
REQUIRED. The client identifier as described in Section 3. REQUIRED. The client identifier as described in Section 2.3.
redirect_uri redirect_uri
REQUIRED, unless a redirection URI has been established between OPTIONAL, as described in Section 3.1.2.
the client and authorization server via other means. Described
in Section 2.1.1.
scope scope
OPTIONAL. The scope of the access request expressed as a list OPTIONAL. The scope of the access request expressed as a list
of space-delimited, case sensitive strings. The value is of space-delimited, case sensitive strings. The value is
defined by the authorization server. If the value contains defined by the authorization server. If the value contains
multiple space-delimited strings, their order does not matter, multiple space-delimited strings, their order does not matter,
and each string adds an additional access range to the and each string adds an additional access range to the
requested scope. requested scope.
state state
OPTIONAL. An opaque value used by the client to maintain state OPTIONAL. An opaque value used by the client to maintain state
between the request and callback. The authorization server between the request and callback. The authorization server
skipping to change at page 18, line 51 skipping to change at page 21, line 50
client. client.
The client directs the resource owner to the constructed URI using an The client directs the resource owner to the constructed URI using an
HTTP redirection response, or by other means available to it via the HTTP redirection response, or by other means available to it via the
user-agent. user-agent.
For example, the client directs the user-agent to make the following For example, the client directs the user-agent to make the following
HTTP request using transport-layer security (extra line breaks are HTTP request using transport-layer security (extra line breaks are
for display purposes only): for display purposes only):
GET /authorize?response_type=code&client_id=s6BhdRkqt3& GET /authorize?response_type=code&client_id=s6BhdRkqt3&state=xyz
redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb HTTP/1.1 &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb HTTP/1.1
Host: server.example.com
Host: server.example.com
The authorization server validates the request to ensure all required The authorization server validates the request to ensure all required
parameters are present and valid. If the request is valid, the parameters are present and valid. If the request is valid, the
authorization server authenticates the resource owner and obtains an authorization server authenticates the resource owner and obtains an
authorization decision (by asking the resource owner or by authorization decision (by asking the resource owner or by
establishing approval via other means). establishing approval via other means).
When a decision is established, the authorization server directs the When a decision is established, the authorization server directs the
user-agent to the provided client redirection URI using an HTTP user-agent to the provided client redirection URI using an HTTP
redirection response, or by other means available to it via the user- redirection response, or by other means available to it via the user-
skipping to change at page 19, line 27 skipping to change at page 22, line 27
4.1.2. Authorization Response 4.1.2. Authorization Response
If the resource owner grants the access request, the authorization If the resource owner grants the access request, the authorization
server issues an authorization code and delivers it to the client by server issues an authorization code and delivers it to the client by
adding the following parameters to the query component of the adding the following parameters to the query component of the
redirection URI using the "application/x-www-form-urlencoded" format: redirection URI using the "application/x-www-form-urlencoded" format:
code code
REQUIRED. The authorization code generated by the REQUIRED. The authorization code generated by the
authorization server. The authorization code SHOULD expire authorization server. The authorization code MUST expire
shortly after it is issued to minimize the risk of leaks. The shortly after it is issued to mitigate the risk of leaks. A
client MUST NOT reuse the authorization code. If an maximum authorization code lifetime of 10 minutes is
authorization code is used more than once, the authorization RECOMMENDED. The client MUST NOT reuse the authorization code.
server MAY revoke all tokens previously issued based on that If an authorization code is used more than once, the
authorization code. The authorization code is bound to the authorization server SHOULD attempt to revoke all tokens
client identifier and redirection URI. previously issued based on that authorization code. The
authorization code is bound to the client identifier and
redirection URI.
state state
REQUIRED if the "state" parameter was present in the client REQUIRED if the "state" parameter was present in the client
authorization request. Set to the exact value received from authorization request. Set to the exact value received from
the client. the client.
For example, the authorization server redirects the user-agent by For example, the authorization server redirects the user-agent by
sending the following HTTP response: sending the following HTTP response:
HTTP/1.1 302 Found HTTP/1.1 302 Found
Location: https://client.example.com/cb?code=i1WsRn1uB1 Location: https://client.example.com/cb?code=SplxlOBeZQQYbYS6WxSbIA
&state=xyz
The client SHOULD ignore unrecognized response parameters. The The client SHOULD ignore unrecognized response parameters. The
authorization code string size is left undefined by this authorization code string size is left undefined by this
specification. The client should avoid making assumptions about code specification. The client should avoid making assumptions about code
value sizes. The authorization server should document the size of value sizes. The authorization server should document the size of
any value it issues. any value it issues.
4.1.2.1. Error Response 4.1.2.1. Error Response
If the request fails due to a missing, invalid, or mismatching If the request fails due to a missing, invalid, or mismatching
redirection URI, or if the client identifier provided is invalid, the redirection URI, or if the client identifier provided is invalid, the
authorization server SHOULD inform the resource owner of the error, authorization server SHOULD inform the resource owner of the error,
and MUST NOT redirect the user-agent to the invalid redirection URI. and MUST NOT automatically redirect the user-agent to the invalid
redirection URI.
If the resource owner denies the access request or if the request If the resource owner denies the access request or if the request
fails for reasons other than a missing or invalid redirection URI, fails for reasons other than a missing or invalid redirection URI,
the authorization server informs the client by adding the following the authorization server informs the client by adding the following
parameters to the query component of the redirection URI using the parameters to the query component of the redirection URI using the
"application/x-www-form-urlencoded" format: "application/x-www-form-urlencoded" format:
error error
REQUIRED. A single error code from the following: REQUIRED. A single error code from the following:
invalid_request invalid_request
skipping to change at page 20, line 36 skipping to change at page 23, line 39
The client is not authorized to request an authorization The client is not authorized to request an authorization
code using this method. code using this method.
access_denied access_denied
The resource owner or authorization server denied the The resource owner or authorization server denied the
request. request.
unsupported_response_type unsupported_response_type
The authorization server does not support obtaining an The authorization server does not support obtaining an
authorization code using this method. authorization code using this method.
invalid_scope invalid_scope
The requested scope is invalid, unknown, or malformed. The requested scope is invalid, unknown, or malformed.
a 4xx or 5xx HTTP status code (except for 400 and 401) server_error
The authorization server MAY set the "error" parameter The authorization server encountered an unexpected
value to a numerical HTTP status code from the 4xx or 5xx condition which prevented it from fulfilling the request.
range, with the exception of the 400 (Bad Request) and temporarily_unavailable
401 (Unauthorized) status codes. For example, if the The authorization server is currently unable to handle
service is temporarily unavailable, the authorization the request due to a temporary overloading or maintenance
server MAY return an error response with "error" set to of the server.
"503".
error_description error_description
OPTIONAL. A human-readable text providing additional OPTIONAL. A human-readable UTF-8 encoded text providing
information, used to assist in the understanding and resolution additional information, used to assist the client developer in
of the error occurred. [[ add language and encoding information understanding the error that occurred.
]]
error_uri error_uri
OPTIONAL. A URI identifying a human-readable web page with OPTIONAL. A URI identifying a human-readable web page with
information about the error, used to provide the resource owner information about the error, used to provide the client
with additional information about the error. developer with additional information about the error.
state state
REQUIRED if a valid "state" parameter was present in the client REQUIRED if a valid "state" parameter was present in the client
authorization request. Set to the exact value received from authorization request. Set to the exact value received from
the client. the client.
For example, the authorization server redirects the user-agent by For example, the authorization server redirects the user-agent by
sending the following HTTP response: sending the following HTTP response:
HTTP/1.1 302 Found HTTP/1.1 302 Found
Location: https://client.example.com/cb?error=access_denied Location: https://client.example.com/cb?error=access_denied&state=xyz
4.1.3. Access Token Request 4.1.3. Access Token Request
The client makes a request to the token endpoint by adding the The client makes a request to the token endpoint by adding the
following parameters using the "application/x-www-form-urlencoded" following parameters using the "application/x-www-form-urlencoded"
format in the HTTP request entity-body: format in the HTTP request entity-body:
grant_type grant_type
REQUIRED. Value MUST be set to "authorization_code". REQUIRED. Value MUST be set to "authorization_code".
client_id
REQUIRED. The client identifier as described in Section 3.
code code
REQUIRED. The authorization code received from the REQUIRED. The authorization code received from the
authorization server. authorization server.
redirect_uri redirect_uri
REQUIRED. The redirection URI used by the authorization server REQUIRED, if the "redirect_uri" parameter was included in the
to return the authorization response in the previous step. authorization request described in Section 4.1.1, and their
values MUST be identical.
The client includes its authentication credentials as described in If the client type is private or was issued client credentials (or
Section 3 assigned other authentication requirements), the client MUST
authenticate with the authorization server as described in
Section 3.2.1.
For example, the client makes the following HTTP using transport- For example, the client makes the following HTTP using transport-
layer security (extra line breaks are for display purposes only): layer security (extra line breaks are for display purposes only):
POST /token HTTP/1.1 POST /token HTTP/1.1
Host: server.example.com Host: server.example.com
Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
Content-Type: application/x-www-form-urlencoded Content-Type: application/x-www-form-urlencoded;charset=UTF-8
grant_type=authorization_code&client_id=s6BhdRkqt3& grant_type=authorization_code&code=SplxlOBeZQQYbYS6WxSbIA
code=i1WsRn1uB1& &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb
redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb
The authorization server MUST: The authorization server MUST:
o Validate the client credentials and ensure that the authorization o require client authentication for private clients or for any
code was issued to that client. client issued client credentials (or with other authentication
o Verify that the authorization code is valid, and that the requirements),
redirection URI matches the redirection URI used by the o authenticate the client if client authentication is included and
authorization server to deliver the authorization code. ensure the authorization code was issued to the authenticated
client,
o verify that the authorization code is valid, and
o ensure that the "redirect_uri" parameter is present if the
"redirect_uri" parameter was included in the initial authorization
request described in Section 4.1.1, and that their values are
identical.
4.1.4. Access Token Response 4.1.4. Access Token Response
If the access token request is valid and authorized, the If the access token request is valid and authorized, the
authorization server issues an access token and optional refresh authorization server issues an access token and optional refresh
token as described in Section 5.1. If the request client token as described in Section 5.1. If the request client
authentication failed or is invalid, the authorization server returns authentication failed or is invalid, the authorization server returns
an error response as described in Section 5.2. an error response as described in Section 5.2.
An example successful response: An example successful response:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/json Content-Type: application/json;charset=UTF-8
Cache-Control: no-store Cache-Control: no-store
Pragma: no-cache
{ {
"access_token":"SlAV32hkKG", "access_token":"2YotnFZFEjr1zCsicMWpAA",
"token_type":"example", "token_type":"example",
"expires_in":3600, "expires_in":3600,
"refresh_token":"8xLOxBtZp8", "refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA",
"example_parameter":"example_value" "example_parameter":"example_value"
} }
4.2. Implicit Grant 4.2. Implicit Grant
The implicit grant type is suitable for clients incapable of The implicit grant type is used to obtain access tokens (it does not
maintaining their client credentials confidential (for authenticating support the issuance of refresh tokens) and is optimized for public
with the authorization server) such as client applications residing clients known to operate a particular redirection URI. These clients
in a user-agent, typically implemented in a browser using a scripting are typically implemented in a browser using a scripting language
language such as JavaScript. such as JavaScript.
As a redirection-based flow, the client must be capable of As a redirection-based flow, the client must be capable of
interacting with the resource owner's user-agent (typically a web interacting with the resource owner's user-agent (typically a web
browser) and capable of receiving incoming requests (via redirection) browser) and capable of receiving incoming requests (via redirection)
from the authorization server. from the authorization server.
Unlike the authorization code grant type in which the client makes Unlike the authorization code grant type in which the client makes
separate requests for authorization and access token, the client separate requests for authorization and access token, the client
receives the access token as the result of the authorization request. receives the access token as the result of the authorization request.
Using the implicit grant type does not include client authentication The implicit grant type does not include client authentication, and
since the client is unable to maintain their credential relies on the presence of the resource owner and the registration of
confidentiality (the client resides on the resource owner's computer the redirection URI. Because the access token is encoded into the
or device which makes the client credentials accessible and
exploitable). Because the access token is encoded into the
redirection URI, it may be exposed to the resource owner and other redirection URI, it may be exposed to the resource owner and other
applications residing on its computer or device. applications residing on its computer or device.
+----------+ +----------+
| Resource | | Resource |
| Owner | | Owner |
| | | |
+----------+ +----------+
^ ^
| |
(B) (B)
+----|-----+ Client Identifier +---------------+ +----|-----+ Client Identifier +---------------+
| -+----(A)--- & Redirect URI ----->| | | -+----(A)-- & Redirection URI --->| |
| User- | | Authorization | | User- | | Authorization |
| Agent -|----(B)-- User authenticates -->| Server | | Agent -|----(B)-- User authenticates -->| Server |
| | | | | | | |
| |<---(C)---- Redirect URI ------<| | | |<---(C)--- Redirection URI ----<| |
| | with Access Token +---------------+ | | with Access Token +---------------+
| | in Fragment | | in Fragment
| | +---------------+ | | +---------------+
| |----(D)---- Redirect URI ------>| Web Server | | |----(D)--- Redirection URI ---->| Web-Hosted |
| | without Fragment | with Client | | | without Fragment | Client |
| | | Resource | | | | Resource |
| (F) |<---(E)------- Script ---------<| | | (F) |<---(E)------- Script ---------<| |
| | +---------------+ | | +---------------+
+-|--------+ +-|--------+
| | | |
(A) (G) Access Token (A) (G) Access Token
| | | |
^ v ^ v
+---------+ +---------+
| | | |
| Client | | Client |
skipping to change at page 24, line 15 skipping to change at page 28, line 4
The flow illustrated in Figure 4 includes the following steps: The flow illustrated in Figure 4 includes the following steps:
(A) The client initiates the flow by directing the resource owner's (A) The client initiates the flow by directing the resource owner's
user-agent to the authorization endpoint. The client includes user-agent to the authorization endpoint. The client includes
its client identifier, requested scope, local state, and a its client identifier, requested scope, local state, and a
redirection URI to which the authorization server will send the redirection URI to which the authorization server will send the
user-agent back once access is granted (or denied). user-agent back once access is granted (or denied).
(B) The authorization server authenticates the resource owner (via (B) The authorization server authenticates the resource owner (via
the user-agent) and establishes whether the resource owner the user-agent) and establishes whether the resource owner
grants or denies the client's access request. grants or denies the client's access request.
(C) Assuming the resource owner grants access, the authorization (C) Assuming the resource owner grants access, the authorization
server redirects the user-agent back to the client using the server redirects the user-agent back to the client using the
redirection URI provided earlier. The redirection URI includes redirection URI provided earlier. The redirection URI includes
the access token in the URI fragment. the access token in the URI fragment.
(D) The user-agent follows the redirection instructions by making a (D) The user-agent follows the redirection instructions by making a
request to the web server (does not include the fragment). The request to the web-hosted client resource (which does not
user-agent retains the fragment information locally. include the fragment). The user-agent retains the fragment
(E) The web server returns a web page (typically an HTML document information locally.
with an embedded script) capable of accessing the full (E) The web-hosted client resource returns a web page (typically an
redirection URI including the fragment retained by the user- HTML document with an embedded script) capable of accessing the
agent, and extracting the access token (and other parameters) full redirection URI including the fragment retained by the
contained in the fragment. user-agent, and extracting the access token (and other
(F) The user-agent executes the script provided by the web server parameters) contained in the fragment.
locally, which extracts the access token and passes it to the (F) The user-agent executes the script provided by the web-hosted
client. client resource locally, which extracts the access token and
passes it to the client.
4.2.1. Authorization Request 4.2.1. Authorization Request
The client constructs the request URI by adding the following The client constructs the request URI by adding the following
parameters to the query component of the authorization endpoint URI parameters to the query component of the authorization endpoint URI
using the "application/x-www-form-urlencoded" format: using the "application/x-www-form-urlencoded" format:
response_type response_type
REQUIRED. Value MUST be set to "token". REQUIRED. Value MUST be set to "token".
client_id client_id
REQUIRED. The client identifier as described in Section 3. REQUIRED. The client identifier as described in Section 2.3.
redirect_uri redirect_uri
REQUIRED, unless a redirection URI has been established between OPTIONAL, as described in Section 3.1.2.
the client and authorization server via other means. Described
in Section 2.1.1.
scope scope
OPTIONAL. The scope of the access request expressed as a list OPTIONAL. The scope of the access request expressed as a list
of space-delimited, case sensitive strings. The value is of space-delimited, case sensitive strings. The value is
defined by the authorization server. If the value contains defined by the authorization server. If the value contains
multiple space-delimited strings, their order does not matter, multiple space-delimited strings, their order does not matter,
and each string adds an additional access range to the and each string adds an additional access range to the
requested scope. requested scope.
state state
OPTIONAL. An opaque value used by the client to maintain state OPTIONAL. An opaque value used by the client to maintain state
between the request and callback. The authorization server between the request and callback. The authorization server
includes this value when redirecting the user-agent back to the includes this value when redirecting the user-agent back to the
client. client.
The client directs the resource owner to the constructed URI using an The client directs the resource owner to the constructed URI using an
HTTP redirection response, or by other means available to it via the HTTP redirection response, or by other means available to it via the
user-agent. user-agent.
skipping to change at page 25, line 19 skipping to change at page 29, line 9
client. client.
The client directs the resource owner to the constructed URI using an The client directs the resource owner to the constructed URI using an
HTTP redirection response, or by other means available to it via the HTTP redirection response, or by other means available to it via the
user-agent. user-agent.
For example, the client directs the user-agent to make the following For example, the client directs the user-agent to make the following
HTTP request using transport-layer security (extra line breaks are HTTP request using transport-layer security (extra line breaks are
for display purposes only): for display purposes only):
GET /authorize?response_type=token&client_id=s6BhdRkqt3& GET /authorize?response_type=token&client_id=s6BhdRkqt3&state=xyz
redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb HTTP/1.1 &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb HTTP/1.1
Host: server.example.com Host: server.example.com
The authorization server validates the request to ensure all required The authorization server validates the request to ensure all required
parameters are present and valid. If the request is valid, the parameters are present and valid. The authorization server MUST
authorization server authenticates the resource owner and obtains an verify that the redirection URI to which it will redirect the access
authorization decision (by asking the resource owner or by token matches a redirection URI registered by the client as described
establishing approval via other means). in Section 3.1.2.
If the request is valid, the authorization server authenticates the
resource owner and obtains an authorization decision (by asking the
resource owner or by establishing approval via other means).
When a decision is established, the authorization server directs the When a decision is established, the authorization server directs the
user-agent to the provided client redirection URI using an HTTP user-agent to the provided client redirection URI using an HTTP
redirection response, or by other means available to it via the user- redirection response, or by other means available to it via the user-
agent. agent.
4.2.2. Access Token Response 4.2.2. Access Token Response
If the resource owner grants the access request, the authorization If the resource owner grants the access request, the authorization
server issues an access token and delivers it to the client by adding server issues an access token and delivers it to the client by adding
skipping to change at page 26, line 4 skipping to change at page 29, line 45
access_token access_token
REQUIRED. The access token issued by the authorization server. REQUIRED. The access token issued by the authorization server.
token_type token_type
REQUIRED. The type of the token issued as described in REQUIRED. The type of the token issued as described in
Section 7.1. Value is case insensitive. Section 7.1. Value is case insensitive.
expires_in expires_in
OPTIONAL. The duration in seconds of the access token OPTIONAL. The duration in seconds of the access token
lifetime. For example, the value "3600" denotes that the lifetime. For example, the value "3600" denotes that the
access token will expire in one hour from the time the response access token will expire in one hour from the time the response
was generated. was generated.
scope scope
OPTIONAL. The scope of the access request expressed as a list OPTIONAL. The scope of the access token expressed as a list of
of space-delimited, case sensitive strings. The value is space-delimited, case sensitive strings. The value is defined
defined by the authorization server. If the value contains by the authorization server. If the value contains multiple
multiple space-delimited strings, their order does not matter, space-delimited strings, their order does not matter, and each
and each string adds an additional access range to the string adds an additional access range to the requested scope.
requested scope. The authorization server SHOULD include the
parameter if the requested scope is different from the one The authorization server SHOULD include the parameter if the
requested by the client. access token scope is different from the one requested by the
client.
state state
REQUIRED if the "state" parameter was present in the client REQUIRED if the "state" parameter was present in the client
authorization request. Set to the exact value received from authorization request. Set to the exact value received from
the client. the client.
For example, the authorization server redirects the user-agent by For example, the authorization server redirects the user-agent by
sending the following HTTP response (URI extra line breaks are for sending the following HTTP response (URI extra line breaks are for
display purposes only): display purposes only):
HTTP/1.1 302 Found HTTP/1.1 302 Found
Location: http://example.com/rd#access_token=FJQbwq9& Location: http://example.com/rd#access_token=2YotnFZFEjr1zCsicMWpAA
token_type=example&expires_in=3600 &state=xyz&token_type=example&expires_in=3600
Developers should note that some HTTP client implementations do not
support the inclusion of a fragment component in the HTTP "Location"
response header field. Such client will require using other methods
for redirecting the client than a 3xx redirection response. For
example, returning an HTML page which includes a 'continue' button
with an action linked to the redirection URI.
The client SHOULD ignore unrecognized response parameters. The The client SHOULD ignore unrecognized response parameters. The
access token string size is left undefined by this specification. access token string size is left undefined by this specification.
The client should avoid making assumptions about value sizes. The The client should avoid making assumptions about value sizes. The
authorization server should document the size of any value it issues. authorization server should document the size of any value it issues.
4.2.2.1. Error Response 4.2.2.1. Error Response
If the request fails due to a missing, invalid, or mismatching If the request fails due to a missing, invalid, or mismatching
redirection URI, or if the client identifier provided is invalid, the redirection URI, or if the client identifier provided is invalid, the
authorization server SHOULD inform the resource owner of the error, authorization server SHOULD inform the resource owner of the error,
and MUST NOT redirect the user-agent to the invalid redirection URI. and MUST NOT automatically redirect the user-agent to the invalid
redirection URI.
If the resource owner denies the access request or if the request If the resource owner denies the access request or if the request
fails for reasons other than a missing or invalid redirection URI, fails for reasons other than a missing or invalid redirection URI,
the authorization server informs the client by adding the following the authorization server informs the client by adding the following
parameters to the fragment component of the redirection URI using the parameters to the fragment component of the redirection URI using the
"application/x-www-form-urlencoded" format: "application/x-www-form-urlencoded" format:
error error
REQUIRED. A single error code from the following: REQUIRED. A single error code from the following:
invalid_request invalid_request
The request is missing a required parameter, includes an The request is missing a required parameter, includes an
unsupported parameter or parameter value, or is otherwise unsupported parameter or parameter value, or is otherwise
malformed. malformed.
unauthorized_client unauthorized_client
The client is not authorized to request an access token The client is not authorized to request an access token
using this method. using this method.
access_denied access_denied
The resource owner or authorization server denied the The resource owner or authorization server denied the
request. request.
skipping to change at page 27, line 20 skipping to change at page 31, line 22
The client is not authorized to request an access token The client is not authorized to request an access token
using this method. using this method.
access_denied access_denied
The resource owner or authorization server denied the The resource owner or authorization server denied the
request. request.
unsupported_response_type unsupported_response_type
The authorization server does not support obtaining an The authorization server does not support obtaining an
access token using this method. access token using this method.
invalid_scope invalid_scope
The requested scope is invalid, unknown, or malformed. The requested scope is invalid, unknown, or malformed.
a 4xx or 5xx HTTP status code (except for 400 and 401) server_error
The authorization server MAY set the "error" parameter The authorization server encountered an unexpected
value to a numerical HTTP status code from the 4xx or 5xx condition which prevented it from fulfilling the request.
range, with the exception of the 400 (Bad Request) and temporarily_unavailable
401 (Unauthorized) status codes. For example, if the The authorization server is currently unable to handle
service is temporarily unavailable, the authorization the request due to a temporary overloading or maintenance
server MAY return an error response with "error" set to of the server.
"503".
error_description error_description
OPTIONAL. A human-readable text providing additional OPTIONAL. A human-readable UTF-8 encoded text providing
information, used to assist in the understanding and resolution additional information, used to assist the client developer in
of the error occurred. [[ add language and encoding information understanding the error that occurred.
]]
error_uri error_uri
OPTIONAL. A URI identifying a human-readable web page with OPTIONAL. A URI identifying a human-readable web page with
information about the error, used to provide the resource owner information about the error, used to provide the client
with additional information about the error. developer with additional information about the error.
state state
REQUIRED if a valid "state" parameter was present in the client REQUIRED if a valid "state" parameter was present in the client
authorization request. Set to the exact value received from authorization request. Set to the exact value received from
the client. the client.
For example, the authorization server redirects the user-agent by For example, the authorization server redirects the user-agent by
sending the following HTTP response: sending the following HTTP response:
HTTP/1.1 302 Found HTTP/1.1 302 Found
Location: https://client.example.com/cb#error=access_denied Location: https://client.example.com/cb#error=access_denied&state=xyz
4.3. Resource Owner Password Credentials 4.3. Resource Owner Password Credentials
The resource owner password credentials grant type is suitable in The resource owner password credentials grant type is suitable in
cases where the resource owner has a trust relationship with the cases where the resource owner has a trust relationship with the
client, such as its computer operating system or a highly privileged client, such as its computer operating system or a highly privileged
application. The authorization server should take special care when application. The authorization server should take special care when
enabling the grant type, and only when other flows are not viable. enabling the grant type, and only when other flows are not viable.
The grant type is suitable for clients capable of obtaining the The grant type is suitable for clients capable of obtaining the
resource owner credentials (username and password, typically using an resource owner credentials (username and password, typically using an
interactive form). It is also used to migrate existing clients using interactive form). It is also used to migrate existing clients using
direct authentication schemes such as HTTP Basic or Digest direct authentication schemes such as HTTP Basic or Digest
authentication to OAuth by converting the stored credentials with an authentication to OAuth by converting the stored credentials to an
access token. access token.
+----------+ +----------+
| Resource | | Resource |
| Owner | | Owner |
| | | |
+----------+ +----------+
v v
| | Resource Owner
(A) Password Credentials (A) Password Credentials
| |
v v
+---------+ +---------------+ +---------+ +---------------+
| | Client Credentials | | | |>--(B)---- Resource Owner ------->| |
| |>--(B)---- & Resource Owner ----->| | | | Password Credentials | Authorization |
| Client | Password Credentials | Authorization | | Client | | Server |
| | | Server |
| |<--(C)---- Access Token ---------<| | | |<--(C)---- Access Token ---------<| |
| | (w/ Optional Refresh Token) | | | | (w/ Optional Refresh Token) | |
+---------+ +---------------+ +---------+ +---------------+
Figure 5: Resource Owner Password Credentials Flow Figure 5: Resource Owner Password Credentials Flow
The flow illustrated in Figure 5 includes the following steps: The flow illustrated in Figure 5 includes the following steps:
(A) The resource owner provides the client with its username and (A) The resource owner provides the client with its username and
password. password.
(B) The client requests an access token from the authorization (B) The client requests an access token from the authorization
server's token endpoint by authenticating using its client server's token endpoint by including the credentials received
credentials, and includes the credentials received from the from the resource owner. When making the request, the client
resource owner. authenticates with the authorization server.
(C) The authorization server validates the resource owner (C) The authorization server authenticates the client and validates
credentials and the client credentials and issues an access the resource owner credentials, and if valid issues an access
token. token.
4.3.1. Authorization Request and Response 4.3.1. Authorization Request and Response
The method through which the client obtains the resource owner The method through which the client obtains the resource owner
credentials is beyond the scope of this specification. The client credentials is beyond the scope of this specification. The client
MUST discard the credentials once an access token has been obtained. MUST discard the credentials once an access token has been obtained.
4.3.2. Access Token Request 4.3.2. Access Token Request
The client makes a request to the token endpoint by adding the The client makes a request to the token endpoint by adding the
following parameters using the "application/x-www-form-urlencoded" following parameters using the "application/x-www-form-urlencoded"
format in the HTTP request entity-body: format in the HTTP request entity-body:
grant_type grant_type
REQUIRED. Value MUST be set to "password". REQUIRED. Value MUST be set to "password".
client_id
REQUIRED. The client identifier as described in Section 3.
username username
REQUIRED. The resource owner username, encoded as UTF-8. REQUIRED. The resource owner username, encoded as UTF-8.
password password
REQUIRED. The resource owner password, encoded as UTF-8. REQUIRED. The resource owner password, encoded as UTF-8.
scope scope
OPTIONAL. The scope of the access request expressed as a list OPTIONAL. The scope of the access request expressed as a list
of space-delimited, case sensitive strings. The value is of space-delimited, case sensitive strings. The value is
defined by the authorization server. If the value contains defined by the authorization server. If the value contains
multiple space-delimited strings, their order does not matter, multiple space-delimited strings, their order does not matter,
and each string adds an additional access range to the and each string adds an additional access range to the
requested scope. requested scope.
The client includes its authentication credentials as described in If the client type is private or was issued client credentials (or
Section 3 assigned other authentication requirements), the client MUST
authenticate with the authorization server as described in
Section 3.2.1.
For example, the client makes the following HTTP request using For example, the client makes the following HTTP request using
transport-layer security (extra line breaks are for display purposes transport-layer security (extra line breaks are for display purposes
only): only):
POST /token HTTP/1.1 POST /token HTTP/1.1
Host: server.example.com Host: server.example.com
Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
Content-Type: application/x-www-form-urlencoded Content-Type: application/x-www-form-urlencoded;charset=UTF-8
grant_type=password&client_id=s6BhdRkqt3& grant_type=password&username=johndoe&password=A3ddj3w
username=johndoe&password=A3ddj3w
The authorization server MUST: The authorization server MUST:
o Validate the client credentials. o require client authentication for private clients or for any
o Validate the resource owner password credentials. client issued client credentials (or with other authentication
requirements),
o authenticate the client if client authentication is included, and
o validate the resource owner password credentials.
Since this access token request utilizes the resource owner's
password, the authorization server MUST protect the endpoint against
brute force attacks.
4.3.3. Access Token Response 4.3.3. Access Token Response
If the access token request is valid and authorized, the If the access token request is valid and authorized, the
authorization server issues an access token and optional refresh authorization server issues an access token and optional refresh
token as described in Section 5.1. If the request failed client token as described in Section 5.1. If the request failed client
authentication or is invalid, the authorization server returns an authentication or is invalid, the authorization server returns an
error response as described in Section 5.2. error response as described in Section 5.2.
An example successful response: An example successful response:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/json Content-Type: application/json;charset=UTF-8
Cache-Control: no-store Cache-Control: no-store
Pragma: no-cache
{ {
"access_token":"SlAV32hkKG", "access_token":"2YotnFZFEjr1zCsicMWpAA",
"token_type":"example", "token_type":"example",
"expires_in":3600, "expires_in":3600,
"refresh_token":"8xLOxBtZp8", "refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA",
"example_parameter":"example_value" "example_parameter":"example_value"
} }
4.4. Client Credentials 4.4. Client Credentials
The client can request an access token using only its client The client can request an access token using only its client
credentials when the client is requesting access to the protected credentials (or other supported means of authentication) when the
resources under its control, or those of another resource owner which client is requesting access to the protected resources under its
has been previously arranged with the authorization server (the control, or those of another resource owner which has been previously
method of which is beyond the scope of this specification). arranged with the authorization server (the method of which is beyond
the scope of this specification).
The client credentials grant type MUST only be used by private
clients.
+---------+ +---------------+ +---------+ +---------------+
| | | | | | | |
| |>--(A)--- Client Credentials ---->| Authorization | | |>--(A)- Client Authentication --->| Authorization |
| Client | | Server | | Client | | Server |
| |<--(B)---- Access Token ---------<| | | |<--(B)---- Access Token ---------<| |
| | (w/ Optional Refresh Token) | | | | | |
+---------+ +---------------+ +---------+ +---------------+
Figure 6: Client Credentials Flow Figure 6: Client Credentials Flow
The flow illustrated in Figure 6 includes the following steps: The flow illustrated in Figure 6 includes the following steps:
(A) The client requests an access token from the token endpoint by (A) The client authenticates with the authorization server and
authenticating using its client credentials. requests an access token from the token endpoint.
(B) The authorization server validates the client credentials and (B) The authorization server authenticates the client, and if valid
issues an access token. issues an access token.
4.4.1. Authorization Request and Response 4.4.1. Authorization Request and Response
Since the client credentials are used as the authorization grant, no Since the client authentication is used as the authorization grant,
additional authorization request is needed as the client is already no additional authorization request is needed.
in the possession of its client credentials.
4.4.2. Access Token Request 4.4.2. Access Token Request
The client makes a request to the token endpoint by adding the The client makes a request to the token endpoint by adding the
following parameters using the "application/x-www-form-urlencoded" following parameters using the "application/x-www-form-urlencoded"
format in the HTTP request entity-body: format in the HTTP request entity-body:
grant_type grant_type
REQUIRED. Value MUST be set to "client_credentials". REQUIRED. Value MUST be set to "client_credentials".
client_id
REQUIRED. The client identifier as described in Section 3.
scope scope
OPTIONAL. The scope of the access request expressed as a list OPTIONAL. The scope of the access request expressed as a list
of space-delimited, case sensitive strings. The value is of space-delimited, case sensitive strings. The value is
defined by the authorization server. If the value contains defined by the authorization server. If the value contains
multiple space-delimited strings, their order does not matter, multiple space-delimited strings, their order does not matter,
and each string adds an additional access range to the and each string adds an additional access range to the
requested scope. requested scope.
The client includes its authentication credentials as described in The client MUST authenticate with the authorization server as
Section 3 described in Section 3.2.1.
For example, the client makes the following HTTP request using For example, the client makes the following HTTP request using
transport-layer security (extra line breaks are for display purposes transport-layer security (extra line breaks are for display purposes
only): only):
POST /token HTTP/1.1 POST /token HTTP/1.1
Host: server.example.com Host: server.example.com
Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
Content-Type: application/x-www-form-urlencoded Content-Type: application/x-www-form-urlencoded;charset=UTF-8
grant_type=client_credentials&client_id=s6BhdRkqt3 grant_type=client_credentials
The authorization server MUST validate the client credentials. The authorization server MUST authenticate the client.
4.4.3. Access Token Response 4.4.3. Access Token Response
If the access token request is valid and authorized, the If the access token request is valid and authorized, the
authorization server issues an access token and optional refresh authorization server issues an access token as described in
token as described in Section 5.1. If the request failed client Section 5.1. A refresh token SHOULD NOT be included. If the request
authentication or is invalid, the authorization server returns an failed client authentication or is invalid, the authorization server
error response as described in Section 5.2. returns an error response as described in Section 5.2.
An example successful response: An example successful response:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/json Content-Type: application/json;charset=UTF-8
Cache-Control: no-store Cache-Control: no-store
Pragma: no-cache
{ {
"access_token":"SlAV32hkKG", "access_token":"2YotnFZFEjr1zCsicMWpAA",
"token_type":"example", "token_type":"example",
"expires_in":3600, "expires_in":3600,
"refresh_token":"8xLOxBtZp8",
"example_parameter":"example_value" "example_parameter":"example_value"
} }
4.5. Extensions 4.5. Extensions
The client uses an extension grant type by specifying the grant type The client uses an extension grant type by specifying the grant type
using an absolute URI (defined by the authorization server) as the using an absolute URI (defined by the authorization server) as the
value of the "grant_type" parameter of the token endpoint, and by value of the "grant_type" parameter of the token endpoint, and by
adding any additional parameters necessary. adding any additional parameters necessary.
For example, to request an access token using a SAML 2.0 assertion For example, to request an access token using a SAML 2.0 assertion
grant type as defined by [I-D.ietf-oauth-saml2-bearer], the client grant type as defined by [I-D.ietf-oauth-saml2-bearer], the client
makes the following HTTP request using transport-layer security (line makes the following HTTP request using transport-layer security (line
breaks are for display purposes only): breaks are for display purposes only):
POST /token HTTP/1.1 POST /token HTTP/1.1
Host: server.example.com Host: server.example.com
Content-Type: application/x-www-form-urlencoded Content-Type: application/x-www-form-urlencoded;charset=UTF-8
grant_type=http%3A%2F%2Foauth.net%2Fgrant_type%2Fassertion%2F grant_type=http%3A%2F%2Foauth.net%2Fgrant_type%2Fassertion%2F
saml%2F2.0%2Fbearer&assertion=PEFzc2VydGlvbiBJc3N1ZUluc3RhbnQ saml%2F2.0%2Fbearer&assertion=PEFzc2VydGlvbiBJc3N1ZUluc3RhbnQ
[...omitted for brevity...]V0aG5TdGF0ZW1lbnQ-PC9Bc3NlcnRpb24- [...omitted for brevity...]V0aG5TdGF0ZW1lbnQ-PC9Bc3NlcnRpb24-
If the access token request is valid and authorized, the If the access token request is valid and authorized, the
authorization server issues an access token and optional refresh authorization server issues an access token and optional refresh
token as described in Section 5.1. If the request failed client token as described in Section 5.1. If the request failed client
authentication or is invalid, the authorization server returns an authentication or is invalid, the authorization server returns an
error response as described in Section 5.2. error response as described in Section 5.2.
skipping to change at page 33, line 32 skipping to change at page 38, line 4
access_token access_token
REQUIRED. The access token issued by the authorization server. REQUIRED. The access token issued by the authorization server.
token_type token_type
REQUIRED. The type of the token issued as described in REQUIRED. The type of the token issued as described in
Section 7.1. Value is case insensitive. Section 7.1. Value is case insensitive.
expires_in expires_in
OPTIONAL. The duration in seconds of the access token OPTIONAL. The duration in seconds of the access token
lifetime. For example, the value "3600" denotes that the lifetime. For example, the value "3600" denotes that the
access token will expire in one hour from the time the response access token will expire in one hour from the time the response
was generated. was generated.
refresh_token refresh_token
OPTIONAL. The refresh token which can be used to obtain new OPTIONAL. The refresh token which can be used to obtain new
access tokens using the same authorization grant as described access tokens using the same authorization grant as described
in Section 6. in Section 6.
scope scope
OPTIONAL. The scope of the access request expressed as a list OPTIONAL. The scope of the access token expressed as a list of
of space-delimited, case sensitive strings. The value is space-delimited, case sensitive strings. The value is defined
defined by the authorization server. If the value contains by the authorization server. If the value contains multiple
multiple space-delimited strings, their order does not matter, space-delimited strings, their order does not matter, and each
and each string adds an additional access range to the string adds an additional access range to the requested scope.
requested scope. The authorization server SHOULD include the The authorization server SHOULD include the parameter if the
parameter if the requested scope is different from the one access token scope is different from the one requested by the
requested by the client. client.
The parameters are included in the entity body of the HTTP response The parameters are included in the entity body of the HTTP response
using the "application/json" media type as defined by [RFC4627]. The using the "application/json" media type as defined by [RFC4627]. The
parameters are serialized into a JSON structure by adding each parameters are serialized into a JSON structure by adding each
parameter at the highest structure level. Parameter names and string parameter at the highest structure level. Parameter names and string
values are included as JSON strings. Numerical values are included values are included as JSON strings. Numerical values are included
as JSON numbers. as JSON numbers.
The authorization server MUST include the HTTP "Cache-Control" The authorization server MUST include the HTTP "Cache-Control"
response header field [RFC2616] with a value of "no-store" in any response header field [RFC2616] with a value of "no-store" in any
response containing tokens, secrets, or other sensitive information. response containing tokens, secrets, or other sensitive information,
as well as the "Pragma" response header field [RFC2616] with a value
of "no-cache".
For example: For example:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/json Content-Type: application/json;charset=UTF-8
Cache-Control: no-store Cache-Control: no-store
Pragma: no-cache
{ {
"access_token":"SlAV32hkKG", "access_token":"2YotnFZFEjr1zCsicMWpAA",
"token_type":"example", "token_type":"example",
"expires_in":3600, "expires_in":3600,
"refresh_token":"8xLOxBtZp8", "refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA",
"example_parameter":"example_value" "example_parameter":"example_value"
} }
The client SHOULD ignore unrecognized response parameters. The sizes The client SHOULD ignore unrecognized response parameters. The sizes
of tokens and other values received from the authorization server are of tokens and other values received from the authorization server are
left undefined. The client should avoid making assumptions about left undefined. The client should avoid making assumptions about
value sizes. The authorization server should document the size of value sizes. The authorization server should document the size of
any value it issues. any value it issues.
5.2. Error Response 5.2. Error Response
skipping to change at page 34, line 45 skipping to change at page 39, line 21
error error
REQUIRED. A single error code from the following: REQUIRED. A single error code from the following:
invalid_request invalid_request
The request is missing a required parameter, includes an The request is missing a required parameter, includes an
unsupported parameter or parameter value, repeats a unsupported parameter or parameter value, repeats a
parameter, includes multiple credentials, utilizes more parameter, includes multiple credentials, utilizes more
than one mechanism for authenticating the client, or is than one mechanism for authenticating the client, or is
otherwise malformed. otherwise malformed.
invalid_client invalid_client
Client authentication failed (e.g. unknown client, no Client authentication failed (e.g. unknown client, no
client credentials included, multiple client credentials client authentication included, multiple client
included, or unsupported credentials type). The authentications included, or unsupported authentication
authorization server MAY return an HTTP 401 method). The authorization server MAY return an HTTP 401
(Unauthorized) status code to indicate which HTTP (Unauthorized) status code to indicate which HTTP
authentication schemes are supported. If the client authentication schemes are supported. If the client
attempted to authenticate via the "Authorization" request attempted to authenticate via the "Authorization" request
header field, the authorization server MUST respond with header field, the authorization server MUST respond with
an HTTP 401 (Unauthorized) status code, and include the an HTTP 401 (Unauthorized) status code, and include the
"WWW-Authenticate" response header field matching the "WWW-Authenticate" response header field matching the
authentication scheme used by the client. authentication scheme used by the client.
invalid_grant invalid_grant
The provided authorization grant is invalid, expired, The provided authorization grant is invalid, expired,
revoked, does not match the redirection URI used in the revoked, does not match the redirection URI used in the
skipping to change at page 35, line 23 skipping to change at page 39, line 45
unauthorized_client unauthorized_client
The authenticated client is not authorized to use this The authenticated client is not authorized to use this
authorization grant type. authorization grant type.
unsupported_grant_type unsupported_grant_type
The authorization grant type is not supported by the The authorization grant type is not supported by the
authorization server. authorization server.
invalid_scope invalid_scope
The requested scope is invalid, unknown, malformed, or The requested scope is invalid, unknown, malformed, or
exceeds the scope granted by the resource owner. exceeds the scope granted by the resource owner.
error_description error_description
OPTIONAL. A human-readable text providing additional OPTIONAL. A human-readable UTF-8 encoded text providing
information, used to assist in the understanding and resolution additional information, used to assist the client developer in
of the error occurred. [[ add language and encoding information understanding the error that occurred.
]]
error_uri error_uri
OPTIONAL. A URI identifying a human-readable web page with OPTIONAL. A URI identifying a human-readable web page with
information about the error, used to provide the resource owner information about the error, used to provide the client
with additional information about the error. developer with additional information about the error.
The parameters are included in the entity body of the HTTP response The parameters are included in the entity body of the HTTP response
using the "application/json" media type as defined by [RFC4627]. The using the "application/json" media type as defined by [RFC4627]. The
parameters are serialized into a JSON structure by adding each parameters are serialized into a JSON structure by adding each
parameter at the highest structure level. Parameter names and string parameter at the highest structure level. Parameter names and string
values are included as JSON strings. Numerical values are included values are included as JSON strings. Numerical values are included
as JSON numbers. as JSON numbers.
For example: For example:
HTTP/1.1 400 Bad Request HTTP/1.1 400 Bad Request
Content-Type: application/json Content-Type: application/json;charset=UTF-8
Cache-Control: no-store Cache-Control: no-store
Pragma: no-cache
{ {
"error":"invalid_request" "error":"invalid_request"
} }
If the authorization server encounters an error condition other than
the 400 (Bad Request) and 401 (Unauthorized) responses described
above (e.g. the service is temporarily unavailable), the
authorization server SHOULD include an error response in the entity
body, and set the "error" parameter value to the numerical HTTP
status code returned.
For example:
HTTP/1.1 503 Service Unavailable
Content-Type: application/json
{
"error":"503"
}
6. Refreshing an Access Token 6. Refreshing an Access Token
If the authorization server issued a refresh token to the client, the If the authorization server issued a refresh token to the client, the
client makes a refresh request to the token endpoint by adding the client makes a refresh request to the token endpoint by adding the
following parameters using the "application/x-www-form-urlencoded" following parameters using the "application/x-www-form-urlencoded"
format in the HTTP request entity-body: format in the HTTP request entity-body:
grant_type grant_type
REQUIRED. Value MUST be set to "refresh_token". REQUIRED. Value MUST be set to "refresh_token".
client_id
REQUIRED. The client identifier as described in Section 3.
refresh_token refresh_token
REQUIRED. The refresh token issued to the client. REQUIRED. The refresh token issued to the client.
scope scope
OPTIONAL. The scope of the access request expressed as a list OPTIONAL. The scope of the access request expressed as a list
of space-delimited, case sensitive strings. The value is of space-delimited, case sensitive strings. The value is
defined by the authorization server. If the value contains defined by the authorization server. If the value contains
multiple space-delimited strings, their order does not matter, multiple space-delimited strings, their order does not matter,
and each string adds an additional access range to the and each string adds an additional access range to the
requested scope. The requested scope MUST be equal or lesser requested scope. The requested scope MUST be equal or lesser
than the scope originally granted by the resource owner, and if than the scope originally granted by the resource owner, and if
omitted is treated as equal to the scope originally granted by omitted is treated as equal to the scope originally granted by
the resource owner. the resource owner.
The client includes its authentication credentials as described in Because refresh tokens are typically long-lasting credentials used to
Section 3. request additional access tokens, the refresh token is bound to the
client it was issued. If the client type is private or was issued
client credentials (or assigned other authentication requirements),
the client MUST authenticate with the authorization server as
described in Section 3.2.1.
For example, the client makes the following HTTP request using For example, the client makes the following HTTP request using
transport-layer security (extra line breaks are for display purposes transport-layer security (extra line breaks are for display purposes
only): only):
POST /token HTTP/1.1 POST /token HTTP/1.1
Host: server.example.com Host: server.example.com
Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
Content-Type: application/x-www-form-urlencoded Content-Type: application/x-www-form-urlencoded;charset=UTF-8
grant_type=refresh_token&client_id=s6BhdRkqt3& grant_type=refresh_token&refresh_token=tGzv3JOkF0XG5Qx2TlKWIA
refresh_token=n4E9O119d
The authorization server MUST validate the client credentials, ensure The authorization server MUST:
that the refresh token was issued to the authenticated client,
validate the refresh token, and verify that the resource owner's
authorization is still valid. If valid and authorized, the
authorization server issues an access token as described in
Section 5.1. If the request failed verification or is invalid, the
authorization server returns an error response as described in
Section 5.2.
The authorization server MAY issue a new refresh token, in which o require client authentication for private clients or for any
case, the client MUST discard the old refresh token and replace it client issued client credentials (or with other authentication
with the new refresh token. requirements),
o authenticate the client if client authentication is included and
ensure the refresh token was issued to the authenticated client,
o validate the refresh token, and
o verify that the resource owner's authorization is still valid.
If valid and authorized, the authorization server issues an access
token as described in Section 5.1. If the request failed
verification or is invalid, the authorization server returns an error
response as described in Section 5.2.
The authorization server MAY issue a new refresh token, in which case
the client MUST discard the old refresh token and replace it with the
new refresh token. The authorization server MAY revoke the old
refresh token after issuing a new refresh token to the client. If a
new refresh token is issued, its scope MUST be identical to that of
the refresh token included in the request.
7. Accessing Protected Resources 7. Accessing Protected Resources
The client accesses protected resources by presenting the access The client accesses protected resources by presenting the access
token to the resource server. The resource server MUST validate the token to the resource server. The resource server MUST validate the
access token and ensure it has not expired and that its scope covers access token and ensure it has not expired and that its scope covers
the requested resource. The methods used by the resource server to the requested resource. The methods used by the resource server to
validate the access token (as well as any error responses) are beyond validate the access token (as well as any error responses) are beyond
the scope of this specification, but generally involve an interaction the scope of this specification, but generally involve an interaction
or coordination between the resource server and the authorization or coordination between the resource server and the authorization
skipping to change at page 38, line 10 skipping to change at page 42, line 21
authenticate with the resource server depends on the type of access authenticate with the resource server depends on the type of access
token issued by the authorization server. Typically, it involves token issued by the authorization server. Typically, it involves
using the HTTP "Authorization" request header field [RFC2617] with an using the HTTP "Authorization" request header field [RFC2617] with an
authentication scheme defined by the access token type specification. authentication scheme defined by the access token type specification.
7.1. Access Token Types 7.1. Access Token Types
The access token type provides the client with the information The access token type provides the client with the information
required to successfully utilize the access token to make a protected required to successfully utilize the access token to make a protected
resource request (along with type-specific attributes). The client resource request (along with type-specific attributes). The client
MUST NOT use an access token if it does not understand the token MUST NOT use an access token if it does not understand or does not
type. trust the token type.
For example, the "bearer" token type defined in For example, the "bearer" token type defined in
[I-D.ietf-oauth-v2-bearer] is utilized by simply including the access [I-D.ietf-oauth-v2-bearer] is utilized by simply including the access
token string in the request: token string in the request:
GET /resource/1 HTTP/1.1 GET /resource/1 HTTP/1.1
Host: example.com Host: example.com
Authorization: Bearer 7Fjfp0ZBr1KtDRbnfVdmIw Authorization: Bearer 7Fjfp0ZBr1KtDRbnfVdmIw
while the "mac" token type defined in [I-D.ietf-oauth-v2-http-mac] is while the "mac" token type defined in [I-D.ietf-oauth-v2-http-mac] is
skipping to change at page 39, line 45 skipping to change at page 44, line 13
registered values (e.g. begin with 'companyname_'). registered values (e.g. begin with 'companyname_').
8.3. Defining New Authorization Grant Types 8.3. Defining New Authorization Grant Types
New authorization grant types can be defined by assigning them a New authorization grant types can be defined by assigning them a
unique absolute URI for use with the "grant_type" parameter. If the unique absolute URI for use with the "grant_type" parameter. If the
extension grant type requires additional token endpoint parameters, extension grant type requires additional token endpoint parameters,
they MUST be registered in the OAuth parameters registry as described they MUST be registered in the OAuth parameters registry as described
by Section 11.2. by Section 11.2.
8.4. Defining Additional Error Codes 8.4. Defining New Authorization Endpoint Response Types
[[ Pending consensus ]]
New response types for use with the authorization endpoint are
defined and registered in the authorization endpoint response type
registry following the procedure in Section 11.3. Response type
names MUST conform to the response-type ABNF.
response-type = response-name *( "+" response-name )
response-name = 1*response-char
response-char = "_" / DIGIT / ALPHA
The "+" character is reserved for defining composite response types
made up of two or more existing registered response types. Only one
response type of each combination may be registered and used for
making requests. Composite response types are treated and compared
in the same as manner as non-composite response types. The "+"
notation is meant only to improve human readability and is not used
for machine parsing.
For example, an extension can define and register the "token+code"
response type. However, once registered, the same combination cannot
be registered as "code+token", or used to make an authorization
request.
8.5. Defining Additional Error Codes
In cases where protocol extensions (i.e. access token types, In cases where protocol extensions (i.e. access token types,
extension parameters, or extension grant types) require additional extension parameters, or extension grant types) require additional
error codes to be used with the authorization code grant error error codes to be used with the authorization code grant error
response (Section 4.1.2.1), the implicit grant error response response (Section 4.1.2.1), the implicit grant error response
(Section 4.2.2.1), or the token error response (Section 5.2), such (Section 4.2.2.1), or the token error response (Section 5.2), such
error codes MAY be defined. error codes MAY be defined.
Extension error codes MUST be registered (following the procedures in Extension error codes MUST be registered (following the procedures in
Section 11.3) if the extension they are used in conjunction with is a Section 11.4) if the extension they are used in conjunction with is a
registered access token type, a registered endpoint parameter, or an registered access token type, a registered endpoint parameter, or an
extension grant type. Error codes used with unregistered extensions extension grant type. Error codes used with unregistered extensions
MAY be registered. MAY be registered.
Error codes MUST conform to the error-code ABNF, and SHOULD be Error codes MUST conform to the error-code ABNF, and SHOULD be
prefixed by an identifying name when possible. For example, an error prefixed by an identifying name when possible. For example, an error
identifying an invalid value set to the extension parameter "example" identifying an invalid value set to the extension parameter "example"
should be named "example_invalid". should be named "example_invalid".
error-code = ALPHA *error-char error-code = ALPHA *error-char
error-char = "-" / "." / "_" / DIGIT / ALPHA error-char = "-" / "." / "_" / DIGIT / ALPHA
9. Native Applications 9. Native Applications
[[ Pending consensus ]] Native applications are clients installed and executed on the
resource owner's device (i.e. desktop application, native mobile
A native application is a client which is installed and executes on application). Native applications may require special consideration
the end-user's device (i.e. desktop application, native mobile related to security, platform capabilities, and overall end-user
application). Native applications are often capable of interacting experience.
with (or embedding) a user-agent but are limited in how such
interactions affects their overall end-user experience. In many
cases, native applications are incapable of receiving redirection
requests from the authorization server (e.g. due to firewall rules,
operating system restrictions).
Native applications can utilize OAuth in different ways, based on The authorization endpoint requires interaction between the client
their requirements and desired end-user experience: and the resource owner's user-agent. Native applications can invoke
an external user-agent or embed a user-agent within the application.
For example:
o Use the authorization code grant type flow described in o External user-agent - the native application can capture the
Section 4.1 by launching an external user-agent. The native response from the authorization server using a redirection URI
application can capture the response by providing a redirection with an scheme registered with the operating system to invoke the
URI identifying a local (non-network) resource (registered with client as the handler, manual copy-and-paste of the credentials,
the operating system to invoke the native application as handler), running a local web server, installing a user-agent plug-in, or by
or by providing a redirection URI identifying a server-hosted providing a redirection URI identifying a server-hosted resource
resource under the native application's control, which in turn under the client's control, which in turn makes the response
makes the response available to the native application (e.g. using available to the native application.
the user-agent window title or other locations accessible from o Embedded user-agent - the native application obtains the response
outside the user-agent). by directly communicating with the embedded user-agent by
monitoring state changes emitted during the resource load,
monitoring HTTP headers, or accessing the user-agent's cookies
storage.
o Use the authorization code grant type flow described in When choosing between an external or embedded user-agent, developers
Section 4.1 by embedding a user-agent. The native application should consider:
obtains the response by directly communicating with the embedded
user-agent. Embedded user-agents are discouraged as they
typically provide a less consistent user experience and do not
enable the end-user to verify the authorization server's
authenticity.
Native applications SHOULD use the authorization code grant type flow o External user-agents may improve completion rate as the resource
without client password credentials (due to their inability to keep owner may already have an active session with the authorization
the credentials confidential) to obtain short-lived access tokens, server removing the need to re-authenticate, and provide a
and use refresh tokens to maintain access. familiar user-agent user experience and functionality. The
resource owner may also rely on extensions or add-ons to assist
with authentication (e.g. password managers or 2-factor device
reader).
o Embedded user-agents may offer an improved usability, as they
remove the need to switch context and open new windows.
o Embedded user-agents pose a security challenge because resource
owners are authenticating in an unidentified window without access
to the visual protections found on by many of the external user-
agents. Embedded user-agents educate end-user to trust
unidentified requests for authentication (making phishing attacks
easier to execute).
When choosing between launching an external user-agent and an When choosing between implicit and authorization code grant types,
embedding a user-agent, native application developers should consider the following should be considered:
the following:
o External user-agents may improve completion rate as the end-user o Native applications that use the authorization code grant type
may already have an active session with the authorization server flow SHOULD do so without using client password credentials, due
removing the need to re-authenticate, and provide a familiar user- to the native application's inability to keep those credentials
agent user experience. The end-user may also rely on extensions secure.
or add-ons to assist with authentication (e.g. password managers o When using the implicit grant type flow a refresh token is not
or 2-factor device reader). returned.
o Embedded user-agents often offer a better end-user flow, as they
remove the need to switch context and open new windows but also
may provide less familiar features than the external user-agent.
o Embedded user-agents pose a security challenge because end-users
are authenticating in an unidentified window without access to the
visual protections offered by many user-agents. Embedded user-
agents educate end-user to trust unidentified requests for
authentication (making phishing attacks easier to execute).
10. Security Considerations 10. Security Considerations
As a flexible and extensible framework, OAuth's security As a flexible and extensible framework, OAuth's security
considerations depend on many factors. The following sections considerations depend on many factors. The following sections
provide implementers with security guidelines focused on three common provide implementers with security guidelines focused on three common
client types: client types:
Web Application Web Application
A web application is a client running on a web server. End-users A web application is a client running on a web server. Resource
access the client via an HTML user interface rendered in a user- owners access the client via an HTML user interface rendered in a
agent on the end-user's device. The client credentials as well as user-agent on the resource-owner's device. The client credentials
any access token issued to the client are stored on the web server as well as any access token issued to the client are stored on the
and are not exposed to or accessible by the end-user. web server and are not exposed to or accessible by the resource
owner.
User-Agent-based Application User-Agent-based Application
A user-agent-based application is a client in which the client A user-agent-based application is a client in which the client
code is downloaded from a web server and executes within a user- code is downloaded from a web server and executes within a user-
agent on the end-user's device. The OAuth protocol data and agent on the resource owner's device. The OAuth protocol data and
credentials are accessible to the end-user. Since such credentials are accessible to the resource owner. Since such
applications directly reside within the user-agent, they can make applications directly reside within the user-agent, they can make
seamless use of the user-agent capabilities in the end-user seamless use of the user-agent capabilities in the resource owner
authorization process. authorization process.
Native Application Native Application
A native application is a client which is installed and executes A native application is a client which is installed and executes
on the end-user's device. The OAuth protocol data and credentials on the resource owner's device. The OAuth protocol data and
are accessible to the end-user. It is assumed that such an credentials are accessible to the resource owner. It is assumed
application can protect dynamically issued credentials, such as that any client authentication credentials included in the
refresh tokens, from eavesdropping by other applications residing application can be extracted, and furthermore that rotation of the
on the same device. client authentication credentials is not practical. Dynamically
issued credentials such as access tokens or refresh tokens, on the
other hand, can receive an acceptable level of protection. At a
minimum these credentials are protected from hostile servers which
the application may contact. On some platform those credentials
might be protected from other applications residing on the same
device.
A comprehensive OAuth security model and analysis, as well as A comprehensive OAuth security model and analysis, as well as
background for the protocol design is provided in background for the protocol design is provided in
[I-D.lodderstedt-oauth-security]. [I-D.lodderstedt-oauth-security].
10.1. Client Authentication 10.1. Client Authentication
The authorization server issues client credentials to web The authorization server issues client credentials to web
applications for the purpose of authenticating them. The applications for the purpose of authenticating them. The
authorization server is encouraged to consider using stronger client authorization server is encouraged to consider using stronger client
skipping to change at page 42, line 49 skipping to change at page 47, line 47
10.2. Client Impersonation 10.2. Client Impersonation
Given the inability of some clients to keep their client credentials Given the inability of some clients to keep their client credentials
confidential, a malicious client can impersonate another client and confidential, a malicious client can impersonate another client and
obtain access to protected resources. The authorization server MUST obtain access to protected resources. The authorization server MUST
authenticate the client whenever possible. If the authorization authenticate the client whenever possible. If the authorization
server cannot authenticate the a client due to the client's server cannot authenticate the a client due to the client's
limitations, the authorization server should utilize other means to limitations, the authorization server should utilize other means to
protect resource owners from such malicious clients, including but protect resource owners from such malicious clients, including but
not limited to engaging the end-user to assist in identifying the not limited to engaging the resource owner to assist in identifying
client and its source. the client and its source.
The authorization server SHOULD enforce explicit end-user The authorization server SHOULD enforce explicit resource owner
authentication, or prompt the end-user to authorize access again, authentication, or prompt the resource owner to authorize access
providing the end-user with information about the client, scope, and again, providing the resource owner with information about the
duration of the authorization. It is up to the end-user to review client, scope, and duration of the authorization. It is up to the
the information in the context of the current client, and authorize resource owner to review the information in the context of the
the request. current client, and authorize the request.
The authorization server SHOULD NOT automatically, without active The authorization server SHOULD NOT automatically, without active
end-user interaction, process repeated authorization requests without resource owner interaction, process repeated authorization requests
authenticating the client or relying on other measures to ensure the without authenticating the client or relying on other measures to
repeated request comes from a valid client and not an impersonator. ensure the repeated request comes from a valid client and not an
impersonator.
The authorization server SHOULD require the client to pre-register
its redirection URI and validate the value of the "redirect_uri"
against the pre-registered value. The client MUST NOT serve an open
redirector resource which can be used by an attacker to construct an
URI that will pass the authorization server's redirection URI
matching rules, and will redirect the end-user's user-agent to the
attacker's server.
The authorization server SHOULD issue access tokens with limited The authorization server SHOULD require the client to register its
scope and duration to clients incapable of authenticating. redirection URI and validate the value of the "redirect_uri" against
the registered value. The client MUST NOT serve an open redirector
resource which can be used by an attacker to construct an URI that
will pass the authorization server's redirection URI matching rules,
and will redirect the resource owner's user-agent to the attacker's
server.
10.3. Access Token Credentials 10.3. Access Token Credentials
Access token credentials MUST be kept confidential in transit and Access token credentials MUST be kept confidential in transit and
storage, and shared only among the authorization server, the resource storage, and shared only among the authorization server, the resource
servers the credentials are valid for, and the client to whom the servers the credentials are valid for, and the client to whom the
credentials were issued. credentials were issued.
When using the implicit grant type, the access token credentials are When using the implicit grant type, the access token credentials are
transmitted in the URI fragment, which can expose the credentials to transmitted in the URI fragment, which can expose the credentials to
skipping to change at page 44, line 27 skipping to change at page 49, line 23
10.5. Request Confidentiality 10.5. Request Confidentiality
Access token credentials, refresh tokens, resource owner passwords, Access token credentials, refresh tokens, resource owner passwords,
and client secrets MUST NOT be transmitted in the clear. and client secrets MUST NOT be transmitted in the clear.
Authorization codes SHOULD NOT be transmitted in the clear. Authorization codes SHOULD NOT be transmitted in the clear.
10.6. Endpoints Authenticity 10.6. Endpoints Authenticity
In order to prevent man-in-the-middle and phishing attacks, the In order to prevent man-in-the-middle and phishing attacks, the
authorization server MUST implement and require TLS with server-side authorization server MUST implement and require TLS with server
authentication in all exchanges. The client MUST verify the authentication in all exchanges as described by [RFC2818]. The
authorization server's TLS certificate, as well as the respective client MUST validate the authorization server's TLS certificate in
certificate chain. accordance with its requirements for authentication of the server's
identity.
10.7. Credentials Guessing Attacks 10.7. Credentials Guessing Attacks
The authorization server MUST prevent attackers from guessing access The authorization server MUST prevent attackers from guessing access
tokens, authorization codes, refresh tokens, resource owner tokens, authorization codes, refresh tokens, resource owner
passwords, and client secrets. passwords, and client secrets.
When generating tokens and other secrets not intended for direct When generating tokens and other secrets not intended for direct
human utilization, the authorization server MUST use a reasonable human utilization, the authorization server MUST use a reasonable
level of entropy in order to mitigate the risk of guessing attacks. level of entropy in order to mitigate the risk of guessing attacks.
When creating secrets intended for human usage, the authorization When creating secrets intended for human usage, the authorization
server MUST utilize other means to protect those secrets. server MUST utilize other means to protect those secrets.
10.8. Phishing Attacks 10.8. Phishing Attacks
Native applications SHOULD use external browsers instead of embedding Native applications SHOULD use external browsers instead of embedding
browsers within the application when requesting end-user browsers within the application when requesting resource owner
authorization. External browsers offer a familiar user experience authorization. External browsers offer a familiar user experience
and a trusted environment in which end-users can confirm the and a trusted environment in which resource owners can confirm the
authenticity of the authorization server. authenticity of the authorization server.
To reduce the risk of phishing attacks, the authorization servers To reduce the risk of phishing attacks, the authorization servers
MUST utilize TLS to allow user-agents to validate the authorization MUST utilize TLS to allow user-agents to validate the authorization
server's identity. Service providers should educate their end-users server's identity. Service providers should educate their end-users
about the risks of phishing attacks and how they can verify the about the risks of phishing attacks and how they can verify the
authorization server's identity. authorization server's identity.
10.9. Authorization Codes 10.9. Authorization Codes
The transmission of authorization codes SHOULD be made over a secure The transmission of authorization codes SHOULD be made over a secure
channel, and the client SHOULD implement TLS for use with its channel, and the client SHOULD implement TLS for use with its
redirection URI if the URI identifies a network resource. redirection URI if the URI identifies a network resource.
Authorization codes MUST be kept confidential. Since authorization Authorization codes MUST be kept confidential. Since authorization
codes are transmitted via user-agent redirections, they could codes are transmitted via user-agent redirections, they could
potentially be disclosed through user-agent history and HTTP referrer potentially be disclosed through user-agent history and HTTP referrer
headers. headers.
Authorization codes operate as plaintext bearer credentials, used to Authorization codes operate as plaintext bearer credentials, used to
verify that the end-user who granted authorization at the verify that the resource owner who granted authorization at the
authorization server, is the same end-user returning to the client to authorization server, is the same resource owner returning to the
complete the process. Therefore, if the client relies on the client to complete the process. Therefore, if the client relies on
authorization code for its own end-user authentication, the client the authorization code for its own resource owner authentication, the
redirection endpoint MUST require TLS. client redirection endpoint MUST require TLS.
Authorization codes SHOULD be short lived and MUST be single use. If Authorization codes MUST be short lived and single use. If the
the authorization server observes multiple attempts to exchange an authorization server observes multiple attempts to exchange an
authorization code for an access token, the authorization server authorization code for an access token, the authorization server
SHOULD revoke all access tokens already granted based on the SHOULD attempt to revoke all access tokens already granted based on
compromised authorization code. the compromised authorization code.
If the client can be authenticated, the authorization servers MUST If the client can be authenticated, the authorization servers MUST
authenticate the client and ensure that the authorization code was authenticate the client and ensure that the authorization code was
issued to the same client. issued to the same client.
10.10. Session Fixation 10.10. Authorization Code Leakage
Session fixation attacks leverage the authorization code grant type, Session fixation attacks leverage the authorization code grant type,
by tricking an end-user to authorize access to a legitimate client, by tricking a resource owner to authorize access to a legitimate
but to a client account under the control of the attacker. The only client, but to a client account under the control of the attacker.
difference between a valid flow and the attack flow is in how the The only difference between a valid flow and the attack flow is in
victim reached the authorization server to grant access. Once at the how the victim reached the authorization server to grant access.
authorization server, the victim is prompted with a normal, valid Once at the authorization server, the victim is prompted with a
request on behalf of a legitimate and familiar client. The attacker normal, valid request on behalf of a legitimate and familiar client.
then uses the victim's authorization to gain access to the The attacker then uses the victim's authorization to gain access to
information authorized by the victim. the information authorized by the victim.
In order to prevent such an attack, authorization servers MUST ensure In order to prevent such an attack, authorization servers MUST ensure
that the redirection URI used to obtain the authorization code, is that the redirection URI used to obtain the authorization code, is
the same as the redirection URI provided when exchanging the the same as the redirection URI provided when exchanging the
authorization code for an access token. The authorization server authorization code for an access token. The authorization server
SHOULD require the client to pre-register their redirection URI and SHOULD require the client to register their redirection URI and if
if provided, MUST validate the redirection URI received in the provided, MUST validate the redirection URI received in the
authorization request against the pre-registered value. authorization request against the registered value.
10.11. Redirection URI Validation 10.11. Redirection URI Validation
[[ Add specific recommendations about redirection validation and [[ Add specific recommendations about redirection validation and
matching ]] matching ]]
10.12. Resource Owner Password Credentials 10.12. Resource Owner Password Credentials
The resource owner password credentials grant type is often used for The resource owner password credentials grant type is often used for
legacy or migration reasons. It reduces the overall risk of storing legacy or migration reasons. It reduces the overall risk of storing
skipping to change at page 46, line 37 skipping to change at page 51, line 33
Additionally, because the resource owner does not have control over Additionally, because the resource owner does not have control over
the authorization process (the resource owner involvement ends when the authorization process (the resource owner involvement ends when
it hands over its credentials to the client), the client can obtain it hands over its credentials to the client), the client can obtain
access tokens with a broader scope and longer duration than desired access tokens with a broader scope and longer duration than desired
by the resource owner. The authorization server SHOULD restrict the by the resource owner. The authorization server SHOULD restrict the
scope and duration of access tokens issued via this grant type. scope and duration of access tokens issued via this grant type.
The authorization server and client SHOULD minimize use of this grant The authorization server and client SHOULD minimize use of this grant
type and utilize other grant types whenever possible. type and utilize other grant types whenever possible.
10.13. XSRF/CSRF Prevention 10.13. Cross-Site Request Forgery
[[ Add text with reference to the 'state' parameter ]] Cross-site request forgery (CSRF) is a web-based attack whereby HTTP
requests are transmitted from the user-agent of an end-user the
server trusts or has authenticated. CSRF attacks on the
authorization endpoint can allow an attacker to obtain authorization
without the consent of the resource owner.
The "state" request parameter SHOULD be used to mitigate against CSRF
attacks, particularly for login CSRF attacks. CSRF attacks against
the client's redirection URI allow an attacker to inject their own
authorization code or access token, which can result in the client
using an access token associated with the attacker's account rather
than the victim's. Depending on the nature of the client and the
protected resources, this can have undesirable and damaging effects.
It is strongly RECOMMENDED that the client includes the "state"
request parameter with authorization requests to the authorization
server. The "state" request parameter MUST contain a non-guessable
value, and the client MUST keep it in a location accessible only by
the client or the user-agent (i.e., protected by same-origin policy).
For example, using a DOM variable (protected by JavaScript or other
DOM-binding language's enforcement of SOP), HTTP cookie, or HTML5
client-side storage. The authorization server includes the value of
the "state" parameter when redirecting the user-agent back to the
client which MUST then ensure the received value matches the stored
value.
10.14. Clickjacking
11. IANA Considerations 11. IANA Considerations
11.1. The OAuth Access Token Type Registry 11.1. The OAuth Access Token Type Registry
This specification establishes the OAuth access token type registry. This specification establishes the OAuth access token type registry.
Access token types are registered on the advice of one or more Access token types are registered on the advice of one or more
Designated Experts (appointed by the IESG or their delegate), with a Designated Experts (appointed by the IESG or their delegate), with a
Specification Required (using terminology from [RFC5226]). However, Specification Required (using terminology from [RFC5226]). However,
skipping to change at page 51, line 8 skipping to change at page 56, line 27
o Parameter name: password o Parameter name: password
o Parameter usage location: token request o Parameter usage location: token request
o Change controller: IETF o Change controller: IETF
o Specification document(s): [[ this document ]] o Specification document(s): [[ this document ]]
o Parameter name: refresh_token o Parameter name: refresh_token
o Parameter usage location: token request, token response o Parameter usage location: token request, token response
o Change controller: IETF o Change controller: IETF
o Specification document(s): [[ this document ]] o Specification document(s): [[ this document ]]
11.3. The OAuth Extensions Error Registry 11.3. The OAuth Authorization Endpoint Response Type Registry
This specification establishes the OAuth authorization endpoint
response type registry.
Additional response type for use with the authorization endpoint are
registered on the advice of one or more Designated Experts (appointed
by the IESG or their delegate), with a Specification Required (using
terminology from [RFC5226]). However, to allow for the allocation of
values prior to publication, the Designated Expert(s) may approve
registration once they are satisfied that such a specification will
be published.
Registration requests should be sent to the [TBD]@ietf.org mailing
list for review and comment, with an appropriate subject (e.g.,
"Request for response type: example"). [[ Note to RFC-EDITOR: The
name of the mailing list should be determined in consultation with
the IESG and IANA. Suggested name: oauth-ext-review. ]]
Within at most 14 days of the request, the Designated Expert(s) will
either approve or deny the registration request, communicating this
decision to the review list and IANA. Denials should include an
explanation and, if applicable, suggestions as to how to make the
request successful.
Decisions (or lack thereof) made by the Designated Expert can be
first appealed to Application Area Directors (contactable using
app-ads@tools.ietf.org email address or directly by looking up their
email addresses on http://www.iesg.org/ website) and, if the
appellant is not satisfied with the response, to the full IESG (using
the iesg@iesg.org mailing list).
IANA should only accept registry updates from the Designated
Expert(s), and should direct all requests for registration to the
review mailing list.
11.3.1. Registration Template
Response type name:
The name requested (e.g., "example").
Change controller:
For standards-track RFCs, state "IETF". For others, give the name
of the responsible party. Other details (e.g., postal address,
e-mail address, home page URI) may also be included.
Specification document(s):
Reference to document that specifies the type, preferably
including a URI that can be used to retrieve a copy of the
document. An indication of the relevant sections may also be
included, but is not required.
11.3.2. Initial Registry Contents
The OAuth Authorization Endpoint Response Type Registry's initial
contents are:
o Response type name: code
o Change controller: IETF
o Specification document(s): [[ this document ]]
o Response type name: token
o Change controller: IETF
o Specification document(s): [[ this document ]]
11.4. The OAuth Extensions Error Registry
This specification establishes the OAuth extensions error registry. This specification establishes the OAuth extensions error registry.
Additional error codes used together with other protocol extensions Additional error codes used together with other protocol extensions
(i.e. extension grant types, access token types, or extension (i.e. extension grant types, access token types, or extension
parameters) are registered on the advice of one or more Designated parameters) are registered on the advice of one or more Designated
Experts (appointed by the IESG or their delegate), with a Experts (appointed by the IESG or their delegate), with a
Specification Required (using terminology from [RFC5226]). However, Specification Required (using terminology from [RFC5226]). However,
to allow for the allocation of values prior to publication, the to allow for the allocation of values prior to publication, the
Designated Expert(s) may approve registration once they are satisfied Designated Expert(s) may approve registration once they are satisfied
skipping to change at page 51, line 44 skipping to change at page 58, line 30
first appealed to Application Area Directors (contactable using first appealed to Application Area Directors (contactable using
app-ads@tools.ietf.org email address or directly by looking up their app-ads@tools.ietf.org email address or directly by looking up their
email addresses on http://www.iesg.org/ website) and, if the email addresses on http://www.iesg.org/ website) and, if the
appellant is not satisfied with the response, to the full IESG (using appellant is not satisfied with the response, to the full IESG (using
the iesg@iesg.org mailing list). the iesg@iesg.org mailing list).
IANA should only accept registry updates from the Designated IANA should only accept registry updates from the Designated
Expert(s), and should direct all requests for registration to the Expert(s), and should direct all requests for registration to the
review mailing list. review mailing list.
11.3.1. Registration Template 11.4.1. Registration Template
Error name: Error name:
The name requested (e.g., "example"). The name requested (e.g., "example").
Error usage location: Error usage location:
The location(s) where the error can be used. The possible The location(s) where the error can be used. The possible
locations are: authorization code grant error response locations are: authorization code grant error response
(Section 4.1.2.1), implicit grant error response (Section 4.1.2.1), implicit grant error response
(Section 4.2.2.1), or token error response (Section 5.2). (Section 4.2.2.1), or token error response (Section 5.2).
Related protocol extension: Related protocol extension:
The name of the extension grant type, access token type, or The name of the extension grant type, access token type, or
extension parameter, the error code is used in conjunction with. extension parameter, the error code is used in conjunction with.
Change controller: Change controller:
For standards-track RFCs, state "IETF". For others, give the name For standards-track RFCs, state "IETF". For others, give the name
skipping to change at page 52, line 49 skipping to change at page 59, line 31
The OAuth WRAP specification was edited by Dick Hardt and authored by The OAuth WRAP specification was edited by Dick Hardt and authored by
Brian Eaton, Yaron Goland, Dick Hardt, and Allen Tom. Brian Eaton, Yaron Goland, Dick Hardt, and Allen Tom.
This specification is the work of the OAuth Working Group which This specification is the work of the OAuth Working Group which
includes dozens of active and dedicated participants. In particular, includes dozens of active and dedicated participants. In particular,
the following individuals contributed ideas, feedback, and wording the following individuals contributed ideas, feedback, and wording
which shaped and formed the final specification: which shaped and formed the final specification:
Michael Adams, Andrew Arnott, Dirk Balfanz, Scott Cantor, Blaine Michael Adams, Andrew Arnott, Dirk Balfanz, Scott Cantor, Blaine
Cook, Brian Campbell, Leah Culver, Bill de hOra, Brian Eaton, Brian Cook, Brian Campbell, Brian Eaton, Leah Culver, Bill de hOra, Brian
Ellin, Igor Faynberg, George Fletcher, Tim Freeman, Evan Gilbert, Eaton, Brian Ellin, Igor Faynberg, George Fletcher, Tim Freeman, Evan
Yaron Goland, Brent Goldman, Kristoffer Gronowski, Justin Hart, Craig Gilbert, Yaron Goland, Brent Goldman, Kristoffer Gronowski, Justin
Heath, Phil Hunt, Michael B. Jones, John Kemp, Mark Kent, Raffi Hart, Dick Hardt, Craig Heath, Phil Hunt, Michael B. Jones, John
Krikorian, Chasen Le Hara, Rasmus Lerdorf, Torsten Lodderstedt, Hui- Kemp, Mark Kent, Raffi Krikorian, Chasen Le Hara, Rasmus Lerdorf,
Lan Lu, Paul Madsen, Alastair Mair, Eve Maler, James Manger, Mark Torsten Lodderstedt, Hui-Lan Lu, Paul Madsen, Alastair Mair, Eve
McGloin, Laurence Miao, Chuck Mortimore, Justin Richer, Peter Saint- Maler, James Manger, Mark McGloin, Laurence Miao, Chuck Mortimore,
Andre, Nat Sakimura, Rob Sayre, Marius Scurtescu, Naitik Shah, Luke Anthony Nadalin, Justin Richer, Peter Saint-Andre, Nat Sakimura, Rob
Shepard, Vlad Skvortsov, Justin Smith, Jeremy Suriel, Christian Sayre, Marius Scurtescu, Naitik Shah, Luke Shepard, Vlad Skvortsov,
Stuebner, Paul Tarjan, Allen Tom, Franklin Tse, Nick Walker, Skylar Justin Smith, Jeremy Suriel, Christian Stuebner, Paul Tarjan, Allen
Woodward. Tom, Franklin Tse, Nick Walker, Shane Weeden, and Skylar Woodward.
Appendix A. Editor's Notes Appendix A. Editor's Notes
While many people contributed to this specification throughout its While many people contributed to this specification throughout its
long journey, the editor would like to acknowledge and thank a few long journey, the editor would like to acknowledge and thank a few
individuals for their outstanding and invaluable efforts leading up individuals for their outstanding and invaluable efforts leading up
to the publication of this specification. It is these individuals to the publication of this specification. It is these individuals
without whom this work would not have existed, or reached its without whom this work would not have existed or reached its
successful conclusion. successful conclusion.
David Recordon for continuously being one of OAuth's most valuable David Recordon for continuously being one of OAuth's most valuable
assets, bringing pragmatism and urgency to the work, and helping assets, bringing pragmatism and urgency to the work, and helping
shape it from its very beginning, as well as being one of the best shape it from its very beginning, as well as being one of the best
collaborators I had the pleasure of working with. collaborators I had the pleasure of working with.
Mark Nottingham for introducing OAuth to the IETF and setting the Mark Nottingham for introducing OAuth to the IETF and setting the
community on this course. Lisa Dusseault for her support and community on this course. Lisa Dusseault for her support and
guidance as the Application area director. Blaine Cook, Peter Saint- guidance as the Application area director. Blaine Cook, Peter Saint-
skipping to change at page 54, line 10 skipping to change at page 60, line 39
[RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.
[RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S., [RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S.,
Leach, P., Luotonen, A., and L. Stewart, "HTTP Leach, P., Luotonen, A., and L. Stewart, "HTTP
Authentication: Basic and Digest Access Authentication", Authentication: Basic and Digest Access Authentication",
RFC 2617, June 1999. RFC 2617, June 1999.
[RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000.
[RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifier (URI): Generic Syntax", STD 66, Resource Identifier (URI): Generic Syntax", STD 66,
RFC 3986, January 2005. RFC 3986, January 2005.
[RFC4627] Crockford, D., "The application/json Media Type for [RFC4627] Crockford, D., "The application/json Media Type for
JavaScript Object Notation (JSON)", RFC 4627, July 2006. JavaScript Object Notation (JSON)", RFC 4627, July 2006.
[RFC4949] Shirey, R., "Internet Security Glossary, Version 2",
RFC 4949, August 2007.
[RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an
IANA Considerations Section in RFCs", BCP 26, RFC 5226, IANA Considerations Section in RFCs", BCP 26, RFC 5226,
May 2008. May 2008.
[RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax
Specifications: ABNF", STD 68, RFC 5234, January 2008. Specifications: ABNF", STD 68, RFC 5234, January 2008.
[RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security
(TLS) Protocol Version 1.2", RFC 5246, August 2008. (TLS) Protocol Version 1.2", RFC 5246, August 2008.
[W3C.REC-html401-19991224] [W3C.REC-html401-19991224]
Hors, A., Jacobs, I., and D. Raggett, "HTML 4.01 Jacobs, I., Hors, A., and D. Raggett, "HTML 4.01
Specification", World Wide Web Consortium Specification", World Wide Web Consortium
Recommendation REC-html401-19991224, December 1999, Recommendation REC-html401-19991224, December 1999,
<http://www.w3.org/TR/1999/REC-html401-19991224>. <http://www.w3.org/TR/1999/REC-html401-19991224>.
13.2. Informative References 13.2. Informative References
[I-D.draft-hardt-oauth-01] [I-D.draft-hardt-oauth-01]
Hardt, D., Ed., Tom, A., Eaton, B., and Y. Goland, "OAuth Hardt, D., Ed., Tom, A., Eaton, B., and Y. Goland, "OAuth
Web Resource Authorization Profiles", January 2010. Web Resource Authorization Profiles", January 2010.
 End of changes. 188 change blocks. 
667 lines changed or deleted 960 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/