OAuth Core 1.

0
Abstract
The OAuth protocol enables websites or applications (Consumers) to access Protected Resources from a web service (Service Provider) via an API, without requiring Users to disclose their Service Provider credentials to the Consumers. More generally, OAuth creates a freely-implementable and generic methodology for API authentication. An example use case is allowing printing service printer.example.com (the Consumer), to access private photos stored on photos.example.net (the Service Provider) without requiring Users to provide their photos.example.net credentials to printer.example.com. OAuth does not require a specific user interface or interaction pattern, nor does it specify how Service Providers authenticate Users, making the protocol ideally suited for cases where authentication credentials are unavailable to the Consumer, such as with OpenID. OAuth aims to unify the experience and implementation of delegated web service authentication into a single, community-driven protocol. OAuth builds on existing protocols and best practices that have been independently implemented by various websites. An open standard, supported by large and small providers alike, promotes a consistent and trusted experience for both application developers and the users of those applications.

License
This specification is made available under the OAuth Non-Assertion Covenant and Author’s Contribution License For OAuth Specification 1.0 available athttp://oauth.net/license/core/1.0. Copyrights are licensed under the terms of the Creative Commons Attribution –ShareAlike 3.0 license available athttp://creativecommons.org/licenses/by-sa/3.0.

Table of Contents
1. 2. 3. 4. Authors Notation and Conventions Definitions Documentation and Registration 4.1. Request URLs 4.2. Service Providers 4.3. Consumers 5. Parameters 5.1. Parameter Encoding

5.2. Consumer Request Parameters 5.3. Service Provider Response Parameters 5.4. OAuth HTTP Authorization Scheme 6. Authenticating with OAuth 6.1. Obtaining an Unauthorized Request Token 6.2. Obtaining User Authorization 6.3. Obtaining an Access Token 7. Accessing Protected Resources 8. Nonce and Timestamp 9. Signing Requests 9.1. Signature Base String 9.2. HMAC-SHA1 9.3. RSA-SHA1 9.4. PLAINTEXT 10. HTTP Response Codes Appendix A. Appendix A - Protocol Example Appendix A.1. Documentation and Registration Appendix A.2. Obtaining a Request Token Appendix A.3. Requesting User Authorization Appendix A.4. Obtaining an Access Token Appendix A.5. Accessing Protected Resources Appendix B. Security Considerations Appendix B.1. Credentials and Token Exchange Appendix B.2. PLAINTEXT Signature Method Appendix B.3. Confidentiality of Requests Appendix B.4. Spoofing by Counterfeit Servers Appendix B.5. Proxying and Caching of Authenticated Content Appendix B.6. Plaintext Storage of Credentials Appendix B.7. Secrecy of the Consumer Secret Appendix B.8. Phishing Attacks Appendix B.9. Scoping of Access Requests Appendix B.10. Entropy of Secrets Appendix B.11. Denial of Service / Resource Exhaustion Attacks Appendix B.12. Cryptographic Attacks Appendix B.13. Signature Base String Compatibility 11. References § Author’s Address

1. Authors
 Mark Atwood (me@mark.atwood.name)  Richard M. Conlan (zeveck@google.com)  Blaine Cook (blaine@twitter.com)  Leah Culver (leah@pownce.com)  Kellan Elliott-McCrea (kellan@flickr.com)

 Larry Halff (larry@ma.gnolia.com)  Eran Hammer-Lahav (eran@hueniverse.com)  Ben Laurie (benl@google.com)  Chris Messina (chris@citizenagency.com)  John Panzer (jpanzer@acm.org)  Sam Quigley (quigley@emerose.com)  David Recordon (david@sixapart.com)  Eran Sandler (eran@yedda.com)  Jonathan Sergent (sergent@google.com)  Todd Sieling (todd@ma.gnolia.com)  Brian Slesinsky (brian-oauth@slesinsky.org)  Andy Smith (andy@jaiku.com)

2. Notation and Conventions
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [RFC2119]. Domain name examples use [RFC2606].

3. Definitions
Service Provider: A web application that allows access via OAuth. User: An individual who has an account with the Service Provider. Consumer: A website or application that uses OAuth to access the Service Provider on behalf of the User. Protected Resource(s): Data controlled by the Service Provider, which the Consumer can access through authentication. Consumer Developer: An individual or organization that implements a Consumer. Consumer Key: A value used by the Consumer to identify itself to the Service Provider. Consumer Secret: A secret used by the Consumer to establish ownership of the Consumer Key. Request Token: A value used by the Consumer to obtain authorization from the User, and exchanged for an Access Token. Access Token:

User Authorization URL: The URL used to obtain User authorization for Consumer access.2.1. 4.A value used by the Consumer to gain access to the Protected Resources on behalf of the User. and MAY include query and fragment as defined by [RFC3986] section 3. 4. described in Section 6. described in Section 6. described in Section 6. Token Secret: A secret used by the Consumer to establish ownership of a given Token.1.com/authorize . or when verification is achieved through other means such as RSA). The request URL query MUST NOT contain any OAuth Protocol Parameters. Consumer-specific identification allows the Service Provider to vary access levels to Consumers (such as un-throttled access to resources). OAuth Protocol Parameters: Parameters with names beginning with oauth_.example. and path.3. For example: http://sp. Service Providers SHOULD NOT rely on the Consumer Secret as a method to verify the Consumer identity. Documentation and Registration OAuth includes a Consumer Key and matching Consumer Secret that together authenticate the Consumer (as opposed to the User) to the Service Provider. Access Token URL: The URL used to exchange the User-authorized Request Token for an Access Token. The Consumer Secret MAY be an empty string (for example when no Consumer verification is needed. authority. instead of using the User‟s Service Provider credentials. Request URLs OAuth defines three request URLs: Request Token URL: The URL used to obtain an unauthorized Request Token. unless the Consumer Secret is known to be inaccessible to anyone other than the Consumer and the Service Provider. The three URLs MUST include scheme.

The process and requirements for provisioning these are entirely up to the Service Providers. The URLs the Consumer will use when making OAuth requests.2. 5.3. Parameters OAuth Protocol Parameter names and values are case sensitive. Characters not in the unreserved character set ([RFC3986] section 2. GET. 3.3) MUST be encoded. Parameter Encoding All parameter names and values are escaped using the [RFC3986] percentencoding (%xx) mechanism. Each OAuth Protocol Parameters MUST NOT appear more than once per request. 2. Service Providers The Service Provider‟s responsibility is to enable Consumer Developers to establish a Consumer Key and Consumer Secret. The Consumer Developer MAY also be required to provide additional information to the Service Provider upon registration.) used in the Request Token URL and Access Token URL.1. and the HTTP methods (i. Hexadecimal characters in encodings MUST . Service Provider specific parameters MUST NOT begin with oauth_. and are REQUIRED unless otherwise noted. POST.e. etc. Any additional request parameters that the Service Provider requires in order to obtain a Token. Signature methods supported by the Service Provider. Consumers The Consumer Developer MUST establish a Consumer Key and a Consumer Secret with the Service Provider. The Service Provider‟s documentation includes: 1. 5. 4. Characters in the unreserved character set MUST NOT be encoded.4.

future extensions may describe alternate methods for sending the OAuth Protocol Parameters. The methods for sending other request parameters are left undefined. Added to the URLs in the query part (as defined by [RFC3986] section 3). . It uses the standard HTTP Authorization and WWW-Authenticate headers to pass OAuth Protocol Parameters. '~' 5. Text names and values MUST be encoded as UTF-8 octets before percent-encoding them per [RFC3629]. 5. 2. OAuth HTTP Authorization Scheme This section defines an [RFC2617] extension to support OAuth.2. Service Provider Response Parameters Response parameters are sent by the Service Provider to return Tokens and other information to the Consumer in the HTTP response body. but SHOULD NOT use the OAuth HTTP Authorization Scheme header. unreserved = ALPHA. The parameter names and values are first encoded as per Parameter Encoding. '. As the HTTP POST request body with a content-type of application/xwww-form-urlencoded. Consumer Request Parameters OAuth Protocol Parameters are sent from the Consumer to the Service Provider in one of three methods.be upper case. For example: oauth_token=ab3cd9j4ks73hf7g&oauth_token_secret=xyz4992k83j47x0b 5. '-'. and concatenated with the „&‟ character (ASCII code 38) as defined in [RFC3986] Section 2.3.1.4. '_'.'. In the HTTP Authorization header as defined in OAuth HTTP Authorization Scheme. In addition to these defined methods. DIGIT. 3. in order of decreasing preference: 1.

4. oauth_signature_method="HMAC-SHA1". The extension auth-scheme (as defined by [RFC2617]) is insensitive. OAuth and is case- 5. the name is immediately followed by an „=‟ character (ASCII code 61).4.0" 5.com/". 2.example. oauth_nonce="4572616e48616d6d65724c61686176". oauth_version="1. oauth_token="ad180jjd733klru7". For each parameter. section 1. Parameter names and values are encoded per Parameter Encoding. Authorization Header The OAuth Protocol Parameters are sent in the following way: Authorization header the 1. and another „”‟ character (ASCII code 34).It is RECOMMENDED that Service Providers accept the HTTP Authorization header. oauth_timestamp="137131200". 3. a „”‟ character (ASCII code 34).1. WWW-Authenticate Header Service Providers MAY indicate their support for the extension by returning the OAuth HTTP WWW-Authenticate header upon Consumer requests for Protected Resources.2. Consumers SHOULD be able to send OAuth Protocol Parameters in the OAuth Authorizationheader. 4. As per[RFC2617] such a response MAY include additional HTTP WWWAuthenticate headers: . Parameters are separated by a comma character (ASCII code 44) and OPTIONAL linear whitespace per [RFC2617]. For example: Authorization: OAuth realm="http://sp. oauth_consumer_key="0685bd9184jfhq22".2. the parameter value (MAY be empty). oauth_signature="wOJIO9A2W5mFwDgiDvZbTSMK%2FPY%3D". The OPTIONAL realm parameter is added and interpreted per [RFC2617].

OAuth Authentication is done in three steps: 1. MUST only be used once. section 1. The User-authorized Request Token is exchanged for an Access Token. 6. and MAY have a limited lifetime. 3. Authenticating with OAuth OAuth authentication is the process in which Users grant access to their Protected Resources without sharing their credentials with the Consumer. The process uses two Token types: Request Token: Used by the Consumer to ask the User to authorize access to the Protected Resources. Only the Access Token SHALL be used to access the Protect Resources.For example: WWW-Authenticate: OAuth realm="http://sp. Service Providers SHOULD allow Users to revoke Access Tokens. and MUST NOT be used for any other purpose. Access Tokens MAY limit access to certain Protected Resources. . Access Token: Used by the Consumer to access the Protected Resources on behalf of the User.com/" The realm parameter defines a protection realm per [RFC2617].example. The User authorizes the Request Token. OAuth uses Tokens generated by the Service Provider instead of the User‟s credentials in Protected Resources requests.2. 2. The Consumer obtains an unauthorized Request Token. The Consumer exchanges the Request Token for an Access Token. It is RECOMMENDED that Request Tokens have a limited lifetime.

Consumer Obtains a Request Token .1. The Request Token process goes as follows: 6.1. The Request Token‟s sole purpose is to receive User approval and can only be used to obtain an Access Token. Obtaining an Unauthorized Request Token The Consumer obtains an unauthorized Request Token by asking the Service Provider to issue a Token.1.6.

If present. Additional parameters: Any additional parameters. The Service Provider documentation specifies the HTTP method for this request.1. If the request fails verification or is rejected for other reasons.0 . 6. Additional parameters: Any additional parameters. as defined by the Service Provider. The Service Provider MAY include some further details about why the request was rejected in the HTTP response body as defined in Service Provider Response Parameters. The request MUST be signed and contains the following parameters: oauth_consumer_key: The Consumer Key. oauth_timestamp: As defined in Nonce and Timestamp. If successful.2.0 value is left undefined. oauth_version: OPTIONAL. Service Providers‟ response to non-1. oauth_token_secret: The Token Secret. oauth_signature_method: The signature method the Consumer used to sign the request. and HTTP POST is RECOMMENDED. The Service Provider MUST ensure the Request Token cannot be exchanged for an Access Token until the User successfully grants access in Obtaining User Authorization. oauth_signature: The signature as defined in Signing Requests. as defined by the Service Provider. value MUST be 1.0 if this parameter is not present.To obtain a Request Token. the Consumer sends an HTTP request to the Service Provider‟s Request Token URL. it generates a Request Token and Token Secret and returns them to the Consumer in the HTTP response body as defined in Service Provider Response Parameters. oauth_nonce: As defined in Nonce and Timestamp. the Service Provider SHOULD respond with the appropriate response code as defined in HTTP Response Codes. Service Provider Issues an Unauthorized Request Token The Service Provider verifies the signature and Consumer Key. Service Providers MUST assume the protocol version to be 1. . The response contains the following parameters: oauth_token: The Request Token.

6. Note: If a Service Provider knows a Consumer to be running on a mobile device or set-top box. oauth_callback: OPTIONAL. the Service Provider SHOULD ensure that the User Authorization URL and Request Token are suitable for manual entry. Additional parameters: Any additional parameters. 6. Once the request URL has been constructed the Consumer redirects the User to the URL via the User‟s web browser.2. the Consumer MUST obtain approval from the User by directing the User to the Service Provider. Service Provider Authenticates the User and Obtains Consent The Service Provider verifies the User‟s identity and asks for consent as detailed. as defined by the Service Provider.2. the Consumer SHALL notify the User how to manually go to the constructed request URL. or accept requests to the User Authorization URL without it. it does define a set of REQUIRED steps: .2. However. in which case it will prompt the User to enter it manually.1. OAuth does not specify how the Service Provider authenticates the User. The Consumer constructs an HTTP GET request to the Service Provider‟s User Authorization URL with the following parameter: oauth_token: OPTIONAL. Consumer Directs the User to the Service Provider In order for the Consumer to be able to exchange the Request Token for an Access Token. If the Consumer is incapable of automatic HTTP redirection. Obtaining User authorization includes the following steps: 6. Obtaining User Authorization The Consumer cannot use the Request Token until it has been authorized by the User. The Service Provider MAY declare this parameter as REQUIRED. The Consumer MAY specify a URL the Service Provider will use to redirect the User back to the Consumer when Obtaining User Authorization is complete.2. The Request Token obtained in the previous step.

It MAY prompt the User to sign in if the User has not already done so.   The Service Provider MUST first verify the User‟s identity before asking for consent. Obtaining an Access Token . the Service Provider MUST NOT allow access to the Protected Resources. the Service Provider MUST inform the User if it is unable to assure the Consumer‟s true identity. If the User denies access. If no callback URL was provided. 6. The information MAY include other details specific to the Service Provider. and redirects the User‟s web browser to that URL with the following parameters: oauth_token: The Request Token the User authorized or denied. The information includes the duration of the access and the Protected Resources provided. The callback URL MAY include Consumer provided query parameters. the Consumer MAY be notified that the Request Token has been revoked. If the Consumer provided a callback URL in oauth_callback (as described in Consumer Directs the User to the Service Provider). When displaying any identifying information about the Consumer to the User based on the Consumer Key. The Service Provider MUST retain them unmodified and append the oauth_token parameter to the existing query.3. Service Provider Directs the User Back to the Consumer After the User authenticates with the Service Provider and grants permission for Consumer access. If the User denies the Consumer access.3. The Service Provider presents to the User information about the Consumer requesting access (as registered by the Consumer Developer). the Service Provider constructs an HTTP GET request URL. 6.2. The method in which the Service Provider informs the User and the quality of the identity assurance is beyond the scope of this specification. The User MUST grant or deny permission for the Service Provider to give the Consumer access to the Protected Resources on behalf of the User. the Consumer MUST be notified that the Request Token has been authorized and ready to be exchanged for an Access Token. the Service Provider instructs the User to manually inform the Consumer that authorization has completed.

and HTTP POST is RECOMMENDED. To request an Access Token. oauth_token: The Request Token obtained previously. No additional Service Provider specific parameters are allowed when requesting an Access Token to ensure all Token related information is present prior to seeking User approval.2. The Request Token matches the Consumer Key. value MUST be 1. Service Provider Grants an Access Token The Service Provider MUST ensure that:    The request signature has been successfully verified.0 if this parameter is not present. Consumer Requests an Access Token The Request Token and Token Secret MUST be exchanged for an Access Token and Token Secret. and contains the following parameters: oauth_consumer_key: The Consumer Key. oauth_signature: The signature as defined in Signing Requests.1. .0 . The Request Token has never been exchanged for an Access Token. The Service Provider documentation specifies the HTTP method for this request.0 value is left undefined. oauth_nonce: As defined in Nonce and Timestamp.The Consumer exchanges the Request Token for an Access Token capable of accessing the Protected Resources. Obtaining an Access Token includes the following steps: 6.3. 6. Service Providers‟ response to non-1. oauth_timestamp: As defined in Nonce and Timestamp. oauth_signature_method: The signature method the Consumer used to sign the request. If present.3. oauth_version: OPTIONAL. The request MUST be signed per Signing Requests. the Consumer makes an HTTP request to the Service Provider‟s Access Token URL. Service Providers MUST assume the protocol version to be 1.

oauth_signature: The signature as defined in Signing Requests. The request MUST be signed perSigning Requests. oauth_nonce: As defined in Nonce and Timestamp. oauth_version: OPTIONAL. the Service Provider generates an Access Token and Token Secret and returns them in the HTTP response body as defined in Service Provider Response Parameters. Additional parameters: Any additional parameters.0. and contains the following parameters: oauth_consumer_key: The Consumer Key. value MUST be 1. oauth_token: The Access Token. The Access Token and Token Secret are stored by the Consumer and used when signing Protected Resources requests. oauth_token_secret: The Token Secret. Accessing Protected Resources After successfully receiving the Access Token and Token Secret. as defined by the Service Provider. The Service Provider MAY include some further details about why the request was rejected in the HTTP response body as defined in Service Provider Response Parameters. Service Providers‟ response to non-1. If present. oauth_timestamp: As defined in Nonce and Timestamp.If successful. oauth_signature_method: The signature method the Consumer used to sign the request. . 7. Additional parameters: Any additional parameters. If the request fails verification or is rejected for other reasons.0 if this parameter is not present. as defined by the Service Provider. the Consumer is able to access the Protected Resources on behalf of the User. the Service Provider SHOULD respond with the appropriate response code as defined in HTTP Response Codes. Service Providers MUST assume the protocol version to be 1. The response contains the following parameters: oauth_token: The Access Token.0 value is left undefined.

A nonce is a random string. When verifying a Consumer signature. The Consumer SHALL then generate a Nonce value that is unique for all requests with that timestamp. Nonce and Timestamp Unless otherwise specified by the Service Provider. with the exception of the oauth_signature parameter. OAuth does not mandate a particular signature method. and stores it in the oauth_signature parameter. The signature process MUST NOT change the request parameter names or values. and PLAINTEXT. The timestamp value MUST be a positive integer and MUST be equal or greater than the timestamp used in previous requests. but Service Providers are free to implement and document their own methods. 1970 00:00:00 GMT. The purpose of signing requests is to prevent unauthorized parties from using the Consumer Key and Tokens when making Token requests or Protected Resources requests. Signature Base String .1. RSA-SHA1. 9. Recommending any particular method is beyond the scope of this specification.8. as each implementation can have its own unique requirements. The Consumer declares a signature method in the oauth_signature_method parameter. The signature process encodes the Consumer Secret and Token Secret into a verifiable value which is included with the request. The protocol defines three signature methods: HMAC-SHA1. 9. uniquely generated for each request. The nonce allows the Service Provider to verify that a request has never been made before and helps prevent replay attacks when requests are made over a non-secure channel (such as HTTP). Signing Requests All Token requests and Protected Resources requests MUST be signed by the Consumer and verified by the Service Provider. the timestamp is expressed in the number of seconds since January 1. generates a signature. the Service Provider SHOULD check the request nonce to ensure it has not been used in a previous Consumer request. The Service Provider verifies the signature as specified in each method.

The parameters are normalized into a single string as follows: 1. sorted and concatenated into a normalized string:    Parameters in the OAuth HTTP Authorization header excluding the realm parameter. z=t a=1. tying the signature to a specific endpoint. Construct Request URL The Signature Base String includes the request absolute URL.2.1. For example: 4. authority. even if the value is empty. using lexicographical byte value ordering.1. and path. the name is separated from the corresponding value by an „=‟ character (ASCII code 61). f=a. 9. TheHMAC-SHA1 signature method provides both a standard and an example of using the Signature Base String with a signing algorithm to generate signatures. The URL used in the Signature Base String MUST include the scheme. c=hi%20there. The oauth_signature parameter MUST be excluded.The Signature Base String is a consistent reproducible concatenation of the request elements into a single string. For example: 2. HTTP GET parameters added to the URLs in the query part (as defined by [RFC3986] section 3). . Each name-value pair is separated by an „&‟ character (ASCII code 38). All the request parameters MUST be encoded as described in Parameter Encoding prior to constructing the Signature Base String. a=1&c=hi%20there&f=25&f=50&f=a&z=p&z=t 9. f=50. If two or more parameters share the same name. z=p. f=25. Normalize Request Parameters The request parameters are collected. and MUST exclude the query and fragment as defined by [RFC3986] section 3. Parameters in the HTTP POST request body (with a contenttype of application/x-www-form-urlencoded). Parameters are concatenated in their sorted order into a single string.1. Parameters are sorted by name. The string is used as an input in hashing or signing algorithms. 3. For each parameter. they are sorted by their value.

it can be constructed by combining the scheme being used. POST. etc. The Service Provider SHOULD document the form of URL used in the Signature Base String to avoid ambiguity due to URL normalization. The request URL from Section 9. Each item is encoded and separated by an „&‟ character (ASCII code 38). GET . 2. Concatenate Request Elements The following items MUST be concatenated in order into a single string. URL scheme and authority MUST be lowercase and include the port number. the HTTP Hostheader. and the relative HTTP request URL.3. See Signature Base String example in Appendix A.1. The normalized request parameters string from Section 9. .1.1. for example: HEAD.com:80/resource?id=123 Is included in the Signature Base String as: http://example.1.2.com/resource 9. 3. For example. 1. 9. The HTTP request method used to send the request. separated by an „&‟ character (ASCII code 38) even if empty. even if empty. Unless specified. the Service Provider SHOULD use the host name communicated to the Consumer in the documentation or other means. HMAC-SHA1 The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104] where the Signature Base String is the text and the key is the concatenated values (each first encoded per Parameter Encoding) of the Consumer Secret and Token Secret.5. If the Host header is not available.2. the request: HTTP://Example. http default port 80 and https default port 443 MUST be excluded. Value MUST be uppercase.1.If the absolute request URL is not available to the Service Provider (it is always available to the Consumer).

.3.8. Signature Base String. RSA-SHA1 The RSA-SHA1 signature method uses the RSASSA-PKCS1-v1_5 signature algorithm as defined in [RFC3447] section 8. 9. 9. then base64-decoded per [RFC2045] section 6. Generating Signature oauth_signature is set to the calculated digest octet string.1.2. M) oauth_signature is set to S.8. using SHA-1 as the hash function for EMSA-PKCS1-v1_5. 9.8.1. and comparing it to the signature provided by the Consumer. first URL-decoded perParameter Encoding.2. Generating Signature The Signature Base String is signed using the Consumer‟s RSA private key per [RFC3447] section 8. where K is the Consumer‟s RSA private key. and the Consumer Secret and Token Secret as stored by the Service Provider. then URL-encoded per Parameter Encoding.2. first base64encoded per [RFC2045] section 6.9. and S is the result signature octet string: M the S = RSASSA-PKCS1-V1_5-SIGN (K. Verifying Signature The Service Provider verifies the request by generating a new request signature octet string.2.3. It is assumed that the Consumer has provided its RSA public key in a verified way to the Service Provider. in a manner which is beyond the scope of this specification.1.2 (more simply known as PKCS#1). The signature is generated using the request parameters as provided by the Consumer. then URL-encoded per Parameter Encoding. first base64-encoded per [RFC2045] section 6.

PLAINTEXT The PLAINTEXT method does not provide any security protection and SHOULD only be used over a secure channel such as HTTPS. M is the Signature Base String. separated by a „&‟ character (ASCII code 38). These examples show the value of oauth_signature for Consumer Secret djr9rjt0jd78jf88 and 3 different Token Secrets: jjd999tj88uiths3: oauth_signature=djr9rjt0jd78jf88%26jjd999tj88uiths3 jjd99$tj88uiths3: oauth_signature=djr9rjt0jd78jf88%26jjd99%2524tj88uiths 3 Empty: oauth_signature=djr9rjt0jd78jf88%26 . e) is the Consumer‟s RSA public key.1.3.9. and S is the octet string representation of the oauth_signature value: RSASSA-PKCS1-V1_5-VERIFY ((n. The result MUST be encoded again.2. Generating Signature oauth_signature is set to the concatenated encoded values of the Consumer Secret and Token Secret.2. 9. M. even if either secret is empty. It does not use the Signature Base String.4.4. Verifying Signature The Service Provider verifies the signature per [RFC3447] section 8.2. where (n. S) 9. e).

example.net is a photo sharing website. This is done to simplify the example and should not be taken as an endorsement of one method over the others. and ensures they match the secrets stored locally.net using her username and password. . the Service Provider SHOULD use the response codes defined in [RFC2616] Section 10.4. the Service Provider photos.  HTTP 400 Bad Request o Unsupported parameter o Unsupported signature method o Missing required parameter o Duplicated OAuth Protocol Parameter HTTP 401 Unauthorized o Invalid Consumer Key o Invalid / expired Token o Invalid signature o Invalid / used nonce  Appendix A. Jane.Protocol Example In this example. and the Consumer printer. In general. Other Users cannot access that photo.com.example. HTTP Response Codes This section applies only to the Request Token and Access Token requests.jpg.example. Appendix A . Verifying Signature The Service Provider verifies the request by breaking the signature value into the Consumer Secret and Token Secret. The requests in this example use the URL query method when sending parameters.example.example. she can access the photo by going to the URL http://photos.example. the User. would like printer. When Jane signs-into photos.com is a photo printing website.9. and Jane does not want to share her username and password with printer.example. it SHOULD respond with HTTP 400 Bad Request or HTTP 401 Unauthorized. 10. When the Service Provider rejects a Consumer request.com to print the private photo vacation.net.jpg stored at photos.2.net/photo?file=vacation.

example.example. and declares the following URLs: Request Token URL: https://photos.example. The Service Provider includes the following header with the response: WWW-Authenticate: OAuth realm="http://photos. and PLAINTEXT only for secure (HTTPS) requests.example.example. The Consumer registration is: Consumer Key: dpf43f3p2l4k3l03 Consumer Secret: kd94hf93k423kf44 Appendix A.2.net/request_token?oauth_consumer_key=dpf4 . the printer website tries to access the photo and receives HTTP 401 Unauthorized indicating it is private.net.example. using HTTP POST User Authorization URL: http://photos.net.com already established a Consumer Key and Consumer Secret with photos. The Consumer printer.net/" The Consumer sends the following HTTP POST request to the Service Provider: https://photos.example.net/access_token.example. using HTTP POST Photo (Protected Resource) URL: http://photos.1.net/photo with required parameter file and optional parameter size The Service Provider declares support for the HMAC-SHA1 signature method for all requests.example.example.net/request_token.net/authorize.example. Documentation and Registration The Service Provider documentation explains how to register for a Consumer Key and Consumer Secret.Appendix A.com that she would like to print her vacation photo stored at photos.net and advertizes its printing services for photos stored on photos. using HTTP GET Access Token URL: https://photos. Obtaining a Request Token After Jane informs printer.

com%2Frequest_token _ready The Service Provider asks Jane to sign-in using her username and password and.example.com access to her private photos.example. http://photos.0 The Service Provider checks the signature and replies with an unauthorized Request Token in the body of the HTTP response: oauth_token=hh5s93j4hdidpola&oauth_token_secret=hdhd0244k9j7ao03 Appendix A.example. asks her if she approves granting printer. If Jane approves the request. it asks the Service Provider to exchange it for an Access Token: https://photos. Obtaining an Access Token Now that the Consumer knows Jane approved the Request Token. Requesting User Authorization The Consumer redirects Jane‟s browser to the Service Provider User Authorization URL to obtain Jane‟s approval for accessing her private photos. if successful.com/request_token_ready?oauth_token=hh5s9 3j4hdidpola Appendix A.3f3p2l4k3l03&oauth_signature_method=PLAINTEXT&oauth_signature=kd 94hf93k423kf44%26&oauth_timestamp=1191242090&oauth_nonce=hsu94j3 884jdopsl&oauth_version=1.3.net/authorize?oauth_token=hh5s93j4hdidpola &oauth_callback=http%3A%2F%2Fprinter. the Service Provider redirects her back to the Consumer‟s callback URL: http://printer.0 .example.example.4.net/access_token?oauth_consumer_key=dpf43 f3p2l4k3l03&oauth_token=hh5s93j4hdidpola&oauth_signature_method= PLAINTEXT&oauth_signature=kd94hf93k423kf44%26hdhd0244k9j7ao03&oa uth_timestamp=1191242092&oauth_nonce=dji430splmx33448&oauth_vers ion=1.

jpg&oauth_consumer_key=dpf43f3p2l4k3l03&oaut h_nonce=kllo9940pd9333jh&oauth_signature_method=HMAC- .1.The Service Provider checks the signature and replies with an Access Token in the body of the HTTP response: oauth_token=nnch734d00sl2jdk&oauth_token_secret=pfkkdhi9sl3r4s00 Appendix A. Appendix A. 2. Generating Signature Base String To generate the signature. 3. GET http://photos.5.jpg size: original The following inputs are used to generate the Signature Base String: 1.5.0 file: vacation. it first needs to generate the Signature Base String. Accessing Protected Resources The Consumer is now ready to request the private photo. it must use HMAC-SHA1.net/photos file=vacation. Since the photo URL is not secure (HTTP).example. The request contains the following parameters (oauth_signature excluded) which are ordered and concatenated into a normalized string: oauth_consumer_key: dpf43f3p2l4k3l03 oauth_token: nnch734d00sl2jdk oauth_signature_method: HMAC-SHA1 oauth_timestamp: 1191242096 oauth_nonce: kllo9940pd9333jh oauth_version: 1.

net/".example. oauth_signature="tR3%2BTy81lMeYAr%2FFid0kMTYa%2FWM%3D".2.SHA1&oauth_timestamp=1191242096&oauth_token=nnch734d00sl2j dk&oauth_version=1. oauth_timestamp="1191242096". oauth_version="1.5. Calculating Signature Value HMAC-SHA1 produces the following digest value as a base64-encoded string (using the Signature Base String as text and kd94hf93k423kf44&pfkkdhi9sl3r4s00 as key): tR3+Ty81lMeYAr/Fid0kMTYa/WM= Appendix A.0" And if using query parameters: .example.3.jpg&size=original Authorization: OAuth realm="http://photos.5. oauth_token="nnch734d00sl2jdk".example. oauth_signature_method="HMAC-SHA1".0%26size%3Doriginal Appendix A.net%2Fphotos&file%3Dvacation.0&size=original The Signature Base String is: GET&http%3A%2F%2Fphotos. oauth_nonce="kllo9940pd9333jh".jpg %26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3Dkllo994 0pd9333jh%26oauth_signature_method%3DHMACSHA1%26oauth_timestamp%3D1191242096%26oauth_token%3Dnnch734d00sl 2jdk%26oauth_version%3D1. the Consumer request for the photo is: http://photos. Requesting Protected Resource All together.net/photos?file=vacation. oauth_consumer_key="dpf43f3p2l4k3l03".

jpg&size=original &oauth_consumer_key=dpf43f3p2l4k3l03&oauth_token=nnch734d00sl2jd k&oauth_signature_method=HMACSHA1&oauth_signature=tR3%2BTy81lMeYAr%2FFid0kMTYa%2FWM%3D&oauth_ timestamp=1191242096&oauth_nonce=kllo9940pd9333jh&oauth_version= 1. The PLAINTEXT signature algorithm is only intended to be used in conjunction with a transport-layer security mechanism such as TLS or SSL which does provide such protection.net checks the signature and responds with the requested photo.example. Credentials and Token Exchange The OAuth specification does not describe any mechanism for protecting Tokens and secrets from eavesdroppers when they are transmitted from the Service Provider to the Consumer inSection 6. PLAINTEXT Signature Method When used with PLAINTEXT signatures.net/photos?file=vacation.3. Appendix B. Appendix B. Security Considerations Appendix B.3.example. Appendix B. If transport-layer protection is unavailable. the PLAINTEXT signature method should not be used.1.0 photos.2 and Section 6.http://photos. Confidentiality of Requests .2. Service Providers should ensure that these transmissions are protected using transport-layer mechanisms such as TLS or SSL.1. the OAuth protocol makes no attempts to protect User credentials from eavesdroppers or man-in-the-middle attacks.2.

to ensure that authenticated content is protected. private authenticated content may be stored in (and thus retrievable from) publicly-accessible caches. . and should employ transport-layer security mechanisms to protect sensitive resources. and should require transport-layer security for any requests where the authenticity of the Service Provider or of request responses is an issue. the Service Provider must have access to these secrets in plaintext form. it provides no guarantee of request confidentiality. eavesdroppers will have full access to request content. in particular.6. Appendix B. A hostile party could take advantage of this by intercepting the Consumer‟s requests and returning misleading or otherwise incorrect responses.While OAuth provides a mechanism for verifying the integrity of requests. Service Providers should carefully consider the kinds of data likely to be sent as part of such requests. which store only a one-way hash of user credentials. Appendix B. Service Providers not using the HTTP Authorization scheme should take care to use other mechanisms. Spoofing by Counterfeit Servers OAuth makes no attempt to verify the authenticity of the Service Provider. In order to compute the signatures used in the non-PLAINTEXTmethods.5. Plaintext Storage of Credentials The Consumer Secret and Token Secret function the same way passwords do in traditional authentication systems.4. Service providers should consider such attacks when developing services based on OAuth. For example. for example. such as the Cache-Control header. to modern operating systems. Unless further precautions are taken. Proxying and Caching of Authenticated Content The HTTP Authorization scheme is optional. This is in contrast. may fail to adequately protect requests not using these headers. Proxies and caches. However. Appendix B. [RFC2616] relies on the Authorization and WWW-Authenticate headers to distinguish authenticated content so that it can be protected.

an attacker may be able to download a copy for analysis. however. For example. Service Providers may wish to make it possible to grant access to some Protected Resources but not others.he or she would be able to perform any action on behalf of any User. other factors such as IP address should be used as well. Appendix B. Service Providers should not use the Consumer Secret alone to verify the identity of the Consumer. . In such cases. Many applications will. Appendix B.8. If Users are not careful to verify the authenticity of these websites before entering their credentials. it is critical that Service Providers protect these secrets from unauthorized access. Secrecy of the Consumer Secret In many applications. Appendix B. A Consumer either has access to Protected Resources or it doesn‟t. OAuth does not provide any method for scoping the access rights granted to a Consumer. and should provide mechanisms that make it easy for Users to confirm the authenticity of their sites. Service Providers should attempt to educate Users about the risks phishing attacks pose.7.or worse. it will be possible for attackers to exploit this practice to steal Users‟ passwords. attackers will be able to recover the Consumer Secret used to authenticate the Consumer to the Service Provider. Accordingly. Where possible. Phishing Attacks Wide deployment of OAuth and similar protocols may cause Users to become inured to the practice of being redirected to websites where they are asked to enter their passwords. or to grant only limited access (such as readonly access) to those Protected Resources. For example. if the Consumer is a freely available desktop application. require greater granularity of access rights. Accordingly. the Consumer application will be under the control of potentially untrusted parties. to the Service Provider‟s database of all such secrets .If an attacker were to gain access to these secrets .9. Scoping of Access Requests By itself.

Service Providers should also take care to ensure that Users understand the access they are granting.When implementing OAuth. It is equally important that the pseudo-random number generator (PRNG) used to generate these secrets be of sufficiently high quality. Service Providers should ensure that it is not possible to mount a brute force attack that recovers the Token Secret in less than two weeks. eavesdroppers will have full access to OAuth requests and signatures. Implementors should be careful to use cryptographically secure PRNGs to avoid these problems. Entropy of Secrets Unless a transport-layer security protocol is used.to resist such attacks for at least the length of time that the secrets are valid. if Token Secrets are valid for two weeks. as well as any risks that may be involved. and use the longest secrets reasonable. Of course. For example.and random enough . but which nevertheless exhibit patterns or other weaknesses which make cryptanalysis or brute force attacks easier. the resources required to track them may exhaust available capacity. Appendix B. OAuth can require Service Providers to perform potentially expensive computations in order to verify the signature on incoming requests. Denial of Service / Resource Exhaustion Attacks The OAuth protocol has a number of features which may make resource exhaustion attacks against Service Providers possible.11. and should provide mechanisms to do so. then an attacker may be able to exhaust the Service Provider‟s entropy pool very quickly by repeatedly obtaining Request Tokens from the Service Provider. If an attacker is able to use many nonces quickly. . Many PRNG implementations generate number sequences that may appear to be random. if a Service Provider includes a nontrivial amount of entropy in Token Secrets as recommended above. And again. Service Providers should be careful to assign Token Secrets and Consumer Secrets which are long enough . For example. An attacker may exploit this to perform a denial of service attack by sending a large number of invalid requests to the Service Provider. and will thus be able to mount offline brute-force attacks to recover the Consumer‟s credentials used. Service Providers should consider the types of access Users may wish to grant Consumers. OAuth requires Service Providers to track used nonces. Service Providers are urged to err on the side of caution.10. Appendix B. Similarly.

N.Resource Exhaustion attacks are by no means specific to OAuth.. and N. The Signature Base String cannot guarantee the order in which parameters are sent. For example. Appendix B. They may. References [NIST] National Institute of Standards and Technolog.” [RFC2045] Freed. and design their implementations accordingly. and by themselves do not pose a significant risk to users of OAuth. When designing additional signature methods. However. Signature Base String Compatibility The Signature Base String has been designed to support the signature methods defined in this specification. Cryptographic Attacks SHA-1. “NIST Brief Comments on Recent Cryptanalytic Attacks on Secure Hashing Functions and the Continued Security Provided by SHA-1. make more efficient attacks possible. Borenstein. Practically speaking. the Signature Base String should be evaluated to ensure compatibility with the algorithms used. entropy starvation typically results in either a complete denial of service while the system waits for new entropy or else in weak (easily guessable) secrets. OAuth implementors should be careful to consider the additional avenues of attack that OAuth exposes. the Signature Base String will not protect against request manipulation. the hash algorithm used in HMAC-SHA1 signatures. “Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies. and NIST has announced [NIST] that it will phase out use of SHA-1 by 2010. however.13. Service Providers should take this into account when considering whether SHA-1 provides an adequate level of security for their applications. has been shown [SHA1] to have a number of cryptographic weaknesses that significantly reduce its resistance to collision attacks. . NIST.” RFC 2045. these weaknesses are difficult to exploit. When implementing OAuth. 11.12. Service Providers should consider which of these presents a more serious risk for their application and design accordingly. If parameter ordering is important and affects the result of a request. Appendix B.

“HTTP Authentication: Basic and Digest Access Authentication.. “Finding SHA-1 Characteristics: General Results and Applications.. S. [SHA1] De Canniere. [RFC3629] Yergeau. M..” RFC 2119. [RFC2606] Eastlake.” RFC 2606. D.net . and R. Canetti. C. [RFC2616] Fielding. Berners-Lee.” Author’s Address OAuth Core Workgroup Email: spec@oauth. A. Masinter. “Public-Key Cryptography Standards (PKCS) #1: RSA Cryptography. Kaliski. J. Frystyk.[RFC2104] Krawczyk. “UTF-8. [RFC3447] Jonsson.. J. Mogul. F.” RFC 3447. T. and T. Hostetler.. “Uniform Resource Identifiers (URI): Generic Syntax.1. Leach. P. P. Specifications Version 2.. and A.” RFC 2617. and B. J. and L.. Bellare. Stewart.. P. “HMAC: Keyed-Hashing for Message Authentication..” RFC 2104. Lawrence. a transformation format of Unicode and ISO 10646. [RFC2617] Franks. J.... “Key words for use in RFCs to Indicate Requirement Levels. H. Leach. B. [RFC2119] Bradner. Rechberger...1. [RFC3986] Berners-Lee.. and C. Hallam-Baker. R.” RFC 3629..” RFC 3986. Luotonen. Gettys. “Reserved Top Level DNS Names. Panitz..” RFC 2616. L. H. “Hypertext Transfer Protocol – HTTP/1. J.

Sign up to vote on this title
UsefulNot useful