1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125
|
<pre>Internet Engineering Task Force (IETF) E. Hammer-Lahav, Ed.
Request for Comments: 5849 April 2010
Category: Informational
ISSN: 2070-1721
<span class="h1">The OAuth 1.0 Protocol</span>
Abstract
OAuth provides a method for clients to access server resources on
behalf of a resource owner (such as a different client or an end-
user). It also provides a process for end-users to authorize third-
party access to their server resources without sharing their
credentials (typically, a username and password pair), using user-
agent redirections.
Status of This Memo
This document is not an Internet Standards Track specification; it is
published for informational purposes.
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by the
Internet Engineering Steering Group (IESG). Not all documents
approved by the IESG are a candidate for any level of Internet
Standard; see <a href="./rfc5741#section-2">Section 2 of RFC 5741</a>.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
<a href="http://www.rfc-editor.org/info/rfc5849">http://www.rfc-editor.org/info/rfc5849</a>.
Copyright Notice
Copyright (c) 2010 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
Provisions Relating to IETF Documents
(<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
<span class="grey">Hammer-Lahav Informational [Page 1]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
Table of Contents
<a href="#section-1">1</a>. Introduction ....................................................<a href="#page-3">3</a>
<a href="#section-1.1">1.1</a>. Terminology ................................................<a href="#page-4">4</a>
<a href="#section-1.2">1.2</a>. Example ....................................................<a href="#page-5">5</a>
<a href="#section-1.3">1.3</a>. Notational Conventions .....................................<a href="#page-7">7</a>
<a href="#section-2">2</a>. Redirection-Based Authorization .................................<a href="#page-8">8</a>
<a href="#section-2.1">2.1</a>. Temporary Credentials ......................................<a href="#page-9">9</a>
<a href="#section-2.2">2.2</a>. Resource Owner Authorization ..............................<a href="#page-10">10</a>
<a href="#section-2.3">2.3</a>. Token Credentials .........................................<a href="#page-12">12</a>
<a href="#section-3">3</a>. Authenticated Requests .........................................<a href="#page-14">14</a>
<a href="#section-3.1">3.1</a>. Making Requests ...........................................<a href="#page-14">14</a>
<a href="#section-3.2">3.2</a>. Verifying Requests ........................................<a href="#page-16">16</a>
<a href="#section-3.3">3.3</a>. Nonce and Timestamp .......................................<a href="#page-17">17</a>
<a href="#section-3.4">3.4</a>. Signature .................................................<a href="#page-18">18</a>
<a href="#section-3.4.1">3.4.1</a>. Signature Base String ..............................<a href="#page-18">18</a>
<a href="#section-3.4.2">3.4.2</a>. HMAC-SHA1 ..........................................<a href="#page-25">25</a>
<a href="#section-3.4.3">3.4.3</a>. RSA-SHA1 ...........................................<a href="#page-25">25</a>
<a href="#section-3.4.4">3.4.4</a>. PLAINTEXT ..........................................<a href="#page-26">26</a>
<a href="#section-3.5">3.5</a>. Parameter Transmission ....................................<a href="#page-26">26</a>
<a href="#section-3.5.1">3.5.1</a>. Authorization Header ...............................<a href="#page-27">27</a>
<a href="#section-3.5.2">3.5.2</a>. Form-Encoded Body ..................................<a href="#page-28">28</a>
<a href="#section-3.5.3">3.5.3</a>. Request URI Query ..................................<a href="#page-28">28</a>
<a href="#section-3.6">3.6</a>. Percent Encoding ..........................................<a href="#page-29">29</a>
<a href="#section-4">4</a>. Security Considerations ........................................<a href="#page-29">29</a>
<a href="#section-4.1">4.1</a>. RSA-SHA1 Signature Method .................................<a href="#page-29">29</a>
<a href="#section-4.2">4.2</a>. Confidentiality of Requests ...............................<a href="#page-30">30</a>
<a href="#section-4.3">4.3</a>. Spoofing by Counterfeit Servers ...........................<a href="#page-30">30</a>
<a href="#section-4.4">4.4</a>. Proxying and Caching of Authenticated Content .............<a href="#page-30">30</a>
<a href="#section-4.5">4.5</a>. Plaintext Storage of Credentials ..........................<a href="#page-30">30</a>
<a href="#section-4.6">4.6</a>. Secrecy of the Client Credentials .........................<a href="#page-31">31</a>
<a href="#section-4.7">4.7</a>. Phishing Attacks ..........................................<a href="#page-31">31</a>
<a href="#section-4.8">4.8</a>. Scoping of Access Requests ................................<a href="#page-31">31</a>
<a href="#section-4.9">4.9</a>. Entropy of Secrets ........................................<a href="#page-32">32</a>
<a href="#section-4.10">4.10</a>. Denial-of-Service / Resource-Exhaustion Attacks ..........<a href="#page-32">32</a>
<a href="#section-4.11">4.11</a>. SHA-1 Cryptographic Attacks ..............................<a href="#page-33">33</a>
<a href="#section-4.12">4.12</a>. Signature Base String Limitations ........................<a href="#page-33">33</a>
<a href="#section-4.13">4.13</a>. Cross-Site Request Forgery (CSRF) ........................<a href="#page-33">33</a>
<a href="#section-4.14">4.14</a>. User Interface Redress ...................................<a href="#page-34">34</a>
<a href="#section-4.15">4.15</a>. Automatic Processing of Repeat Authorizations ............<a href="#page-34">34</a>
<a href="#section-5">5</a>. Acknowledgments ................................................<a href="#page-35">35</a>
<a href="#appendix-A">Appendix A</a>. Differences from the Community Edition ...............<a href="#page-36">36</a>
<a href="#section-6">6</a>. References .....................................................<a href="#page-37">37</a>
<a href="#section-6.1">6.1</a>. Normative References ......................................<a href="#page-37">37</a>
<a href="#section-6.2">6.2</a>. Informative References ....................................<a href="#page-38">38</a>
<span class="grey">Hammer-Lahav Informational [Page 2]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
The OAuth protocol was originally created by a small community of web
developers from a variety of websites and other Internet services who
wanted to solve the common problem of enabling delegated access to
protected resources. The resulting OAuth protocol was stabilized at
version 1.0 in October 2007, and revised in June 2009 (Revision A) as
published at <<a href="http://oauth.net/core/1.0a">http://oauth.net/core/1.0a</a>>.
This specification provides an informational documentation of OAuth
Core 1.0 Revision A, addresses several errata reported since that
time, and makes numerous editorial clarifications. While this
specification is not an item of the IETF's OAuth Working Group, which
at the time of writing is working on an OAuth version that can be
appropriate for publication on the standards track, it has been
transferred to the IETF for change control by authors of the original
work.
In the traditional client-server authentication model, the client
uses its credentials to access its resources hosted by the server.
With the increasing use of distributed web services and cloud
computing, third-party applications require access to these server-
hosted resources.
OAuth introduces a third role to the traditional client-server
authentication model: the resource owner. In the OAuth model, the
client (which is not the resource owner, but is acting on its behalf)
requests access to resources controlled by the resource owner, but
hosted by the server. In addition, OAuth allows the server to verify
not only the resource owner authorization, but also the identity of
the client making the request.
OAuth provides a method for clients to access server resources on
behalf of a resource owner (such as a different client or an end-
user). It also provides a process for end-users to authorize third-
party access to their server resources without sharing their
credentials (typically, a username and password pair), using user-
agent redirections.
For example, a web user (resource owner) can grant a printing service
(client) access to her private photos stored at a photo sharing
service (server), without sharing her username and password with the
printing service. Instead, she authenticates directly with the photo
sharing service which issues the printing service delegation-specific
credentials.
<span class="grey">Hammer-Lahav Informational [Page 3]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
In order for the client to access resources, it first has to obtain
permission from the resource owner. This permission is expressed in
the form of a token and matching shared-secret. The purpose of the
token is to make it unnecessary for the resource owner to share its
credentials with the client. Unlike the resource owner credentials,
tokens can be issued with a restricted scope and limited lifetime,
and revoked independently.
This specification consists of two parts. The first part defines a
redirection-based user-agent process for end-users to authorize
client access to their resources, by authenticating directly with the
server and provisioning tokens to the client for use with the
authentication method. The second part defines a method for making
authenticated HTTP [<a href="./rfc2616" title=""Hypertext Transfer Protocol -- HTTP/1.1"">RFC2616</a>] requests using two sets of credentials,
one identifying the client making the request, and a second
identifying the resource owner on whose behalf the request is being
made.
The use of OAuth with any transport protocol other than [<a href="./rfc2616" title=""Hypertext Transfer Protocol -- HTTP/1.1"">RFC2616</a>] is
undefined.
<span class="h3"><a class="selflink" id="section-1.1" href="#section-1.1">1.1</a>. Terminology</span>
client
An HTTP client (per [<a href="./rfc2616" title=""Hypertext Transfer Protocol -- HTTP/1.1"">RFC2616</a>]) capable of making OAuth-
authenticated requests (<a href="#section-3">Section 3</a>).
server
An HTTP server (per [<a href="./rfc2616" title=""Hypertext Transfer Protocol -- HTTP/1.1"">RFC2616</a>]) capable of accepting OAuth-
authenticated requests (<a href="#section-3">Section 3</a>).
protected resource
An access-restricted resource that can be obtained from the
server using an OAuth-authenticated request (<a href="#section-3">Section 3</a>).
resource owner
An entity capable of accessing and controlling protected
resources by using credentials to authenticate with the server.
credentials
Credentials are a pair of a unique identifier and a matching
shared secret. OAuth defines three classes of credentials:
client, temporary, and token, used to identify and authenticate
the client making the request, the authorization request, and
the access grant, respectively.
<span class="grey">Hammer-Lahav Informational [Page 4]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
token
A unique identifier issued by the server and used by the client
to associate authenticated requests with the resource owner
whose authorization is requested or has been obtained by the
client. Tokens have a matching shared-secret that is used by
the client to establish its ownership of the token, and its
authority to represent the resource owner.
The original community specification used a somewhat different
terminology that maps to this specifications as follows (original
community terms provided on left):
Consumer: client
Service Provider: server
User: resource owner
Consumer Key and Secret: client credentials
Request Token and Secret: temporary credentials
Access Token and Secret: token credentials
<span class="h3"><a class="selflink" id="section-1.2" href="#section-1.2">1.2</a>. Example</span>
Jane (resource owner) has recently uploaded some private vacation
photos (protected resources) to her photo sharing site
'photos.example.net' (server). She would like to use the
'printer.example.com' website (client) to print one of these photos.
Typically, Jane signs into 'photos.example.net' using her username
and password.
However, Jane does not wish to share her username and password with
the 'printer.example.com' website, which needs to access the photo in
order to print it. In order to provide its users with better
service, 'printer.example.com' has signed up for a set of
'photos.example.net' client credentials ahead of time:
Client Identifier
dpf43f3p2l4k3l03
Client Shared-Secret:
kd94hf93k423kf44
The 'printer.example.com' website has also configured its application
to use the protocol endpoints listed in the 'photos.example.net' API
documentation, which use the "HMAC-SHA1" signature method:
<span class="grey">Hammer-Lahav Informational [Page 5]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
Temporary Credential Request
https://photos.example.net/initiate
Resource Owner Authorization URI:
https://photos.example.net/authorize
Token Request URI:
https://photos.example.net/token
Before 'printer.example.com' can ask Jane to grant it access to the
photos, it must first establish a set of temporary credentials with
'photos.example.net' to identify the delegation request. To do so,
the client sends the following HTTPS [<a href="./rfc2818" title=""HTTP Over TLS"">RFC2818</a>] request to the server:
POST /initiate HTTP/1.1
Host: photos.example.net
Authorization: OAuth realm="Photos",
oauth_consumer_key="dpf43f3p2l4k3l03",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="137131200",
oauth_nonce="wIjqoS",
oauth_callback="http%3A%2F%2Fprinter.example.com%2Fready",
oauth_signature="74KNZJeDHnMBp0EMJ9ZHt%2FXKycU%3D"
The server validates the request and replies with a set of temporary
credentials in the body of the HTTP response (line breaks are for
display purposes only):
HTTP/1.1 200 OK
Content-Type: application/x-www-form-urlencoded
oauth_token=hh5s93j4hdidpola&oauth_token_secret=hdhd0244k9j7ao03&
oauth_callback_confirmed=true
The client redirects Jane's user-agent to the server's Resource Owner
Authorization endpoint to obtain Jane's approval for accessing her
private photos:
https://photos.example.net/authorize?oauth_token=hh5s93j4hdidpola
The server requests Jane to sign in using her username and password
and if successful, asks her to approve granting 'printer.example.com'
access to her private photos. Jane approves the request and her
user-agent is redirected to the callback URI provided by the client
in the previous request (line breaks are for display purposes only):
http://printer.example.com/ready?
oauth_token=hh5s93j4hdidpola&oauth_verifier=hfdp7dh39dks9884
<span class="grey">Hammer-Lahav Informational [Page 6]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
The callback request informs the client that Jane completed the
authorization process. The client then requests a set of token
credentials using its temporary credentials (over a secure Transport
Layer Security (TLS) channel):
POST /token HTTP/1.1
Host: photos.example.net
Authorization: OAuth realm="Photos",
oauth_consumer_key="dpf43f3p2l4k3l03",
oauth_token="hh5s93j4hdidpola",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="137131201",
oauth_nonce="walatlh",
oauth_verifier="hfdp7dh39dks9884",
oauth_signature="gKgrFCywp7rO0OXSjdot%2FIHF7IU%3D"
The server validates the request and replies with a set of token
credentials in the body of the HTTP response:
HTTP/1.1 200 OK
Content-Type: application/x-www-form-urlencoded
oauth_token=nnch734d00sl2jdk&oauth_token_secret=pfkkdhi9sl3r4s00
With a set of token credentials, the client is now ready to request
the private photo:
GET /photos?file=vacation.jpg&size=original HTTP/1.1
Host: photos.example.net
Authorization: OAuth realm="Photos",
oauth_consumer_key="dpf43f3p2l4k3l03",
oauth_token="nnch734d00sl2jdk",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="137131202",
oauth_nonce="chapoH",
oauth_signature="MdpQcU8iPSUjWoN%2FUDMsK2sui9I%3D"
The 'photos.example.net' server validates the request and responds
with the requested photo. 'printer.example.com' is able to continue
accessing Jane's private photos using the same set of token
credentials for the duration of Jane's authorization, or until Jane
revokes access.
<span class="h3"><a class="selflink" id="section-1.3" href="#section-1.3">1.3</a>. Notational Conventions</span>
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 [<a href="./rfc2119" title=""Key words for use in RFCs to Indicate Requirement Levels"">RFC2119</a>].
<span class="grey">Hammer-Lahav Informational [Page 7]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Redirection-Based Authorization</span>
OAuth uses tokens to represent the authorization granted to the
client by the resource owner. Typically, token credentials are
issued by the server at the resource owner's request, after
authenticating the resource owner's identity (usually using a
username and password).
There are many ways in which a server can facilitate the provisioning
of token credentials. This section defines one such way, using HTTP
redirections and the resource owner's user-agent. This redirection-
based authorization method includes three steps:
1. The client obtains a set of temporary credentials from the server
(in the form of an identifier and shared-secret). The temporary
credentials are used to identify the access request throughout
the authorization process.
2. The resource owner authorizes the server to grant the client's
access request (identified by the temporary credentials).
3. The client uses the temporary credentials to request a set of
token credentials from the server, which will enable it to access
the resource owner's protected resources.
The server MUST revoke the temporary credentials after being used
once to obtain the token credentials. It is RECOMMENDED that the
temporary credentials have a limited lifetime. Servers SHOULD enable
resource owners to revoke token credentials after they have been
issued to clients.
In order for the client to perform these steps, the server needs to
advertise the URIs of the following three endpoints:
Temporary Credential Request
The endpoint used by the client to obtain a set of temporary
credentials as described in <a href="#section-2.1">Section 2.1</a>.
Resource Owner Authorization
The endpoint to which the resource owner is redirected to grant
authorization as described in <a href="#section-2.2">Section 2.2</a>.
Token Request
The endpoint used by the client to request a set of token
credentials using the set of temporary credentials as described
in <a href="#section-2.3">Section 2.3</a>.
<span class="grey">Hammer-Lahav Informational [Page 8]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
The three URIs advertised by the server MAY include a query component
as defined by <a href="./rfc3986#section-3">[RFC3986], Section 3</a>, but if present, the query MUST
NOT contain any parameters beginning with the "oauth_" prefix, to
avoid conflicts with the protocol parameters added to the URIs when
used.
The methods in which the server advertises and documents its three
endpoints are beyond the scope of this specification. Clients should
avoid making assumptions about the size of tokens and other server-
generated values, which are left undefined by this specification. In
addition, protocol parameters MAY include values that require
encoding when transmitted. Clients and servers should not make
assumptions about the possible range of their values.
<span class="h3"><a class="selflink" id="section-2.1" href="#section-2.1">2.1</a>. Temporary Credentials</span>
The client obtains a set of temporary credentials from the server by
making an authenticated (<a href="#section-3">Section 3</a>) HTTP "POST" request to the
Temporary Credential Request endpoint (unless the server advertises
another HTTP request method for the client to use). The client
constructs a request URI by adding the following REQUIRED parameter
to the request (in addition to the other protocol parameters, using
the same parameter transmission method):
oauth_callback: An absolute URI back to which the server will
redirect the resource owner when the Resource Owner
Authorization step (<a href="#section-2.2">Section 2.2</a>) is completed. If
the client is unable to receive callbacks or a
callback URI has been established via other means,
the parameter value MUST be set to "oob" (case
sensitive), to indicate an out-of-band
configuration.
Servers MAY specify additional parameters.
When making the request, the client authenticates using only the
client credentials. The client MAY omit the empty "oauth_token"
protocol parameter from the request and MUST use the empty string as
the token secret value.
Since the request results in the transmission of plain text
credentials in the HTTP response, the server MUST require the use of
a transport-layer mechanisms such as TLS or Secure Socket Layer (SSL)
(or a secure channel with equivalent protections).
<span class="grey">Hammer-Lahav Informational [Page 9]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
For example, the client makes the following HTTPS request:
POST /request_temp_credentials HTTP/1.1
Host: server.example.com
Authorization: OAuth realm="Example",
oauth_consumer_key="jd83jd92dhsh93js",
oauth_signature_method="PLAINTEXT",
oauth_callback="http%3A%2F%2Fclient.example.net%2Fcb%3Fx%3D1",
oauth_signature="ja893SD9%26"
The server MUST verify (<a href="#section-3.2">Section 3.2</a>) the request and if valid,
respond back to the client with a set of temporary credentials (in
the form of an identifier and shared-secret). The temporary
credentials are included in the HTTP response body using the
"application/x-www-form-urlencoded" content type as defined by
[<a href="#ref-W3C.REC-html40-19980424">W3C.REC-html40-19980424</a>] with a 200 status code (OK).
The response contains the following REQUIRED parameters:
oauth_token
The temporary credentials identifier.
oauth_token_secret
The temporary credentials shared-secret.
oauth_callback_confirmed
MUST be present and set to "true". The parameter is used to
differentiate from previous versions of the protocol.
Note that even though the parameter names include the term 'token',
these credentials are not token credentials, but are used in the next
two steps in a similar manner to token credentials.
For example (line breaks are for display purposes only):
HTTP/1.1 200 OK
Content-Type: application/x-www-form-urlencoded
oauth_token=hdk48Djdsa&oauth_token_secret=xyz4992k83j47x0b&
oauth_callback_confirmed=true
<span class="h3"><a class="selflink" id="section-2.2" href="#section-2.2">2.2</a>. Resource Owner Authorization</span>
Before the client requests a set of token credentials from the
server, it MUST send the user to the server to authorize the request.
The client constructs a request URI by adding the following REQUIRED
query parameter to the Resource Owner Authorization endpoint URI:
<span class="grey">Hammer-Lahav Informational [Page 10]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
oauth_token
The temporary credentials identifier obtained in <a href="#section-2.1">Section 2.1</a> in
the "oauth_token" parameter. Servers MAY declare this
parameter as OPTIONAL, in which case they MUST provide a way
for the resource owner to indicate the identifier through other
means.
Servers MAY specify additional parameters.
The client directs the resource owner to the constructed URI using an
HTTP redirection response, or by other means available to it via the
resource owner's user-agent. The request MUST use the HTTP "GET"
method.
For example, the client redirects the resource owner's user-agent to
make the following HTTPS request:
GET /authorize_access?oauth_token=hdk48Djdsa HTTP/1.1
Host: server.example.com
The way in which the server handles the authorization request,
including whether it uses a secure channel such as TLS/SSL is beyond
the scope of this specification. However, the server MUST first
verify the identity of the resource owner.
When asking the resource owner to authorize the requested access, the
server SHOULD present to the resource owner information about the
client requesting access based on the association of the temporary
credentials with the client identity. When displaying any such
information, the server SHOULD indicate if the information has been
verified.
After receiving an authorization decision from the resource owner,
the server redirects the resource owner to the callback URI if one
was provided in the "oauth_callback" parameter or by other means.
To make sure that the resource owner granting access is the same
resource owner returning back to the client to complete the process,
the server MUST generate a verification code: an unguessable value
passed to the client via the resource owner and REQUIRED to complete
the process. The server constructs the request URI by adding the
following REQUIRED parameters to the callback URI query component:
oauth_token
The temporary credentials identifier received from the client.
<span class="grey">Hammer-Lahav Informational [Page 11]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
oauth_verifier
The verification code.
If the callback URI already includes a query component, the server
MUST append the OAuth parameters to the end of the existing query.
For example, the server redirects the resource owner's user-agent to
make the following HTTP request:
GET /cb?x=1&oauth_token=hdk48Djdsa&oauth_verifier=473f82d3 HTTP/1.1
Host: client.example.net
If the client did not provide a callback URI, the server SHOULD
display the value of the verification code, and instruct the resource
owner to manually inform the client that authorization is completed.
If the server knows a client to be running on a limited device, it
SHOULD ensure that the verifier value is suitable for manual entry.
<span class="h3"><a class="selflink" id="section-2.3" href="#section-2.3">2.3</a>. Token Credentials</span>
The client obtains a set of token credentials from the server by
making an authenticated (<a href="#section-3">Section 3</a>) HTTP "POST" request to the Token
Request endpoint (unless the server advertises another HTTP request
method for the client to use). The client constructs a request URI
by adding the following REQUIRED parameter to the request (in
addition to the other protocol parameters, using the same parameter
transmission method):
oauth_verifier
The verification code received from the server in the previous
step.
When making the request, the client authenticates using the client
credentials as well as the temporary credentials. The temporary
credentials are used as a substitute for token credentials in the
authenticated request and transmitted using the "oauth_token"
parameter.
Since the request results in the transmission of plain text
credentials in the HTTP response, the server MUST require the use of
a transport-layer mechanism such as TLS or SSL (or a secure channel
with equivalent protections).
<span class="grey">Hammer-Lahav Informational [Page 12]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
For example, the client makes the following HTTPS request:
POST /request_token HTTP/1.1
Host: server.example.com
Authorization: OAuth realm="Example",
oauth_consumer_key="jd83jd92dhsh93js",
oauth_token="hdk48Djdsa",
oauth_signature_method="PLAINTEXT",
oauth_verifier="473f82d3",
oauth_signature="ja893SD9%26xyz4992k83j47x0b"
The server MUST verify (<a href="#section-3.2">Section 3.2</a>) the validity of the request,
ensure that the resource owner has authorized the provisioning of
token credentials to the client, and ensure that the temporary
credentials have not expired or been used before. The server MUST
also verify the verification code received from the client. If the
request is valid and authorized, the token credentials are included
in the HTTP response body using the
"application/x-www-form-urlencoded" content type as defined by
[<a href="#ref-W3C.REC-html40-19980424">W3C.REC-html40-19980424</a>] with a 200 status code (OK).
The response contains the following REQUIRED parameters:
oauth_token
The token identifier.
oauth_token_secret
The token shared-secret.
For example:
HTTP/1.1 200 OK
Content-Type: application/x-www-form-urlencoded
oauth_token=j49ddk933skd9dks&oauth_token_secret=ll399dj47dskfjdk
The server must retain the scope, duration, and other attributes
approved by the resource owner, and enforce these restrictions when
receiving a client request made with the token credentials issued.
Once the client receives and stores the token credentials, it can
proceed to access protected resources on behalf of the resource owner
by making authenticated requests (<a href="#section-3">Section 3</a>) using the client
credentials together with the token credentials received.
<span class="grey">Hammer-Lahav Informational [Page 13]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Authenticated Requests</span>
The HTTP authentication methods defined by [<a href="./rfc2617" title=""HTTP Authentication: Basic and Digest Access Authentication"">RFC2617</a>] enable clients
to make authenticated HTTP requests. Clients using these methods
gain access to protected resources by using their credentials
(typically, a username and password pair), which allow the server to
verify their authenticity. Using these methods for delegation
requires the client to assume the role of the resource owner.
OAuth provides a method designed to include two sets of credentials
with each request, one to identify the client, and another to
identify the resource owner. Before a client can make authenticated
requests on behalf of the resource owner, it must obtain a token
authorized by the resource owner. <a href="#section-2">Section 2</a> provides one such method
through which the client can obtain a token authorized by the
resource owner.
The client credentials take the form of a unique identifier and an
associated shared-secret or RSA key pair. Prior to making
authenticated requests, the client establishes a set of credentials
with the server. The process and requirements for provisioning these
are outside the scope of this specification. Implementers are urged
to consider the security ramifications of using client credentials,
some of which are described in <a href="#section-4.6">Section 4.6</a>.
Making authenticated requests requires prior knowledge of the
server's configuration. OAuth includes multiple methods for
transmitting protocol parameters with requests (<a href="#section-3.5">Section 3.5</a>), as well
as multiple methods for the client to prove its rightful ownership of
the credentials used (<a href="#section-3.4">Section 3.4</a>). The way in which clients
discover the required configuration is outside the scope of this
specification.
<span class="h3"><a class="selflink" id="section-3.1" href="#section-3.1">3.1</a>. Making Requests</span>
An authenticated request includes several protocol parameters. Each
parameter name begins with the "oauth_" prefix, and the parameter
names and values are case sensitive. Clients make authenticated
requests by calculating the values of a set of protocol parameters
and adding them to the HTTP request as follows:
1. The client assigns value to each of these REQUIRED (unless
specified otherwise) protocol parameters:
<span class="grey">Hammer-Lahav Informational [Page 14]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
oauth_consumer_key
The identifier portion of the client credentials (equivalent to
a username). The parameter name reflects a deprecated term
(Consumer Key) used in previous revisions of the specification,
and has been retained to maintain backward compatibility.
oauth_token
The token value used to associate the request with the resource
owner. If the request is not associated with a resource owner
(no token available), clients MAY omit the parameter.
oauth_signature_method
The name of the signature method used by the client to sign the
request, as defined in <a href="#section-3.4">Section 3.4</a>.
oauth_timestamp
The timestamp value as defined in <a href="#section-3.3">Section 3.3</a>. The parameter
MAY be omitted when using the "PLAINTEXT" signature method.
oauth_nonce
The nonce value as defined in <a href="#section-3.3">Section 3.3</a>. The parameter MAY
be omitted when using the "PLAINTEXT" signature method.
oauth_version
OPTIONAL. If present, MUST be set to "1.0". Provides the
version of the authentication process as defined in this
specification.
2. The protocol parameters are added to the request using one of the
transmission methods listed in <a href="#section-3.5">Section 3.5</a>. Each parameter MUST
NOT appear more than once per request.
3. The client calculates and assigns the value of the
"oauth_signature" parameter as described in <a href="#section-3.4">Section 3.4</a> and adds
the parameter to the request using the same method as in the
previous step.
4. The client sends the authenticated HTTP request to the server.
For example, to make the following HTTP request authenticated (the
"c2&a3=2+q" string in the following examples is used to illustrate
the impact of a form-encoded entity-body):
POST /request?b5=%3D%253D&a3=a&c%40=&a2=r%20b HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded
c2&a3=2+q
<span class="grey">Hammer-Lahav Informational [Page 15]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
The client assigns values to the following protocol parameters using
its client credentials, token credentials, the current timestamp, a
uniquely generated nonce, and indicates that it will use the
"HMAC-SHA1" signature method:
oauth_consumer_key: 9djdj82h48djs9d2
oauth_token: kkk9d7dh3k39sjv7
oauth_signature_method: HMAC-SHA1
oauth_timestamp: 137131201
oauth_nonce: 7d8f3e4a
The client adds the protocol parameters to the request using the
OAuth HTTP "Authorization" header field:
Authorization: OAuth realm="Example",
oauth_consumer_key="9djdj82h48djs9d2",
oauth_token="kkk9d7dh3k39sjv7",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="137131201",
oauth_nonce="7d8f3e4a"
Then, it calculates the value of the "oauth_signature" parameter
(using client secret "j49sk3j29djd" and token secret "dh893hdasih9"),
adds it to the request, and sends the HTTP request to the server:
POST /request?b5=%3D%253D&a3=a&c%40=&a2=r%20b HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded
Authorization: OAuth realm="Example",
oauth_consumer_key="9djdj82h48djs9d2",
oauth_token="kkk9d7dh3k39sjv7",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="137131201",
oauth_nonce="7d8f3e4a",
oauth_signature="bYT5CMsGcbgUdFHObYMEfcx6bsw%3D"
c2&a3=2+q
<span class="h3"><a class="selflink" id="section-3.2" href="#section-3.2">3.2</a>. Verifying Requests</span>
Servers receiving an authenticated request MUST validate it by:
o Recalculating the request signature independently as described in
<a href="#section-3.4">Section 3.4</a> and comparing it to the value received from the client
via the "oauth_signature" parameter.
<span class="grey">Hammer-Lahav Informational [Page 16]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
o If using the "HMAC-SHA1" or "RSA-SHA1" signature methods, ensuring
that the combination of nonce/timestamp/token (if present)
received from the client has not been used before in a previous
request (the server MAY reject requests with stale timestamps as
described in <a href="#section-3.3">Section 3.3</a>).
o If a token is present, verifying the scope and status of the
client authorization as represented by the token (the server MAY
choose to restrict token usage to the client to which it was
issued).
o If the "oauth_version" parameter is present, ensuring its value is
"1.0".
If the request fails verification, the server SHOULD respond with the
appropriate HTTP response status code. The server MAY include
further details about why the request was rejected in the response
body.
The server SHOULD return a 400 (Bad Request) status code when
receiving a request with unsupported parameters, an unsupported
signature method, missing parameters, or duplicated protocol
parameters. The server SHOULD return a 401 (Unauthorized) status
code when receiving a request with invalid client credentials, an
invalid or expired token, an invalid signature, or an invalid or used
nonce.
<span class="h3"><a class="selflink" id="section-3.3" href="#section-3.3">3.3</a>. Nonce and Timestamp</span>
The timestamp value MUST be a positive integer. Unless otherwise
specified by the server's documentation, the timestamp is expressed
in the number of seconds since January 1, 1970 00:00:00 GMT.
A nonce is a random string, uniquely generated by the client to allow
the server to verify that a request has never been made before and
helps prevent replay attacks when requests are made over a non-secure
channel. The nonce value MUST be unique across all requests with the
same timestamp, client credentials, and token combinations.
To avoid the need to retain an infinite number of nonce values for
future checks, servers MAY choose to restrict the time period after
which a request with an old timestamp is rejected. Note that this
restriction implies a level of synchronization between the client's
and server's clocks. Servers applying such a restriction MAY provide
a way for the client to sync with the server's clock; alternatively,
both systems could synchronize with a trusted time service. Details
of clock synchronization strategies are beyond the scope of this
specification.
<span class="grey">Hammer-Lahav Informational [Page 17]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
<span class="h3"><a class="selflink" id="section-3.4" href="#section-3.4">3.4</a>. Signature</span>
OAuth-authenticated requests can have two sets of credentials: those
passed via the "oauth_consumer_key" parameter and those in the
"oauth_token" parameter. In order for the server to verify the
authenticity of the request and prevent unauthorized access, the
client needs to prove that it is the rightful owner of the
credentials. This is accomplished using the shared-secret (or RSA
key) part of each set of credentials.
OAuth provides three methods for the client to prove its rightful
ownership of the credentials: "HMAC-SHA1", "RSA-SHA1", and
"PLAINTEXT". These methods are generally referred to as signature
methods, even though "PLAINTEXT" does not involve a signature. In
addition, "RSA-SHA1" utilizes an RSA key instead of the shared-
secrets associated with the client credentials.
OAuth does not mandate a particular signature method, as each
implementation can have its own unique requirements. Servers are
free to implement and document their own custom methods.
Recommending any particular method is beyond the scope of this
specification. Implementers should review the Security
Considerations section (<a href="#section-4">Section 4</a>) before deciding on which method to
support.
The client declares which signature method is used via the
"oauth_signature_method" parameter. It then generates a signature
(or a string of an equivalent value) and includes it in the
"oauth_signature" parameter. The server verifies the signature as
specified for each method.
The signature process does not change the request or its parameters,
with the exception of the "oauth_signature" parameter.
<span class="h4"><a class="selflink" id="section-3.4.1" href="#section-3.4.1">3.4.1</a>. Signature Base String</span>
The signature base string is a consistent, reproducible concatenation
of several of the HTTP request elements into a single string. The
string is used as an input to the "HMAC-SHA1" and "RSA-SHA1"
signature methods.
The signature base string includes the following components of the
HTTP request:
o The HTTP request method (e.g., "GET", "POST", etc.).
o The authority as declared by the HTTP "Host" request header field.
<span class="grey">Hammer-Lahav Informational [Page 18]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
o The path and query components of the request resource URI.
o The protocol parameters excluding the "oauth_signature".
o Parameters included in the request entity-body if they comply with
the strict restrictions defined in <a href="#section-3.4.1.3">Section 3.4.1.3</a>.
The signature base string does not cover the entire HTTP request.
Most notably, it does not include the entity-body in most requests,
nor does it include most HTTP entity-headers. It is important to
note that the server cannot verify the authenticity of the excluded
request components without using additional protections such as SSL/
TLS or other methods.
<span class="h5"><a class="selflink" id="section-3.4.1.1" href="#section-3.4.1.1">3.4.1.1</a>. String Construction</span>
The signature base string is constructed by concatenating together,
in order, the following HTTP request elements:
1. The HTTP request method in uppercase. For example: "HEAD",
"GET", "POST", etc. If the request uses a custom HTTP method, it
MUST be encoded (<a href="#section-3.6">Section 3.6</a>).
2. An "&" character (ASCII code 38).
3. The base string URI from <a href="#section-3.4.1.2">Section 3.4.1.2</a>, after being encoded
(<a href="#section-3.6">Section 3.6</a>).
4. An "&" character (ASCII code 38).
5. The request parameters as normalized in <a href="#section-3.4.1.3.2">Section 3.4.1.3.2</a>, after
being encoded (<a href="#section-3.6">Section 3.6</a>).
For example, the HTTP request:
POST /request?b5=%3D%253D&a3=a&c%40=&a2=r%20b HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded
Authorization: OAuth realm="Example",
oauth_consumer_key="9djdj82h48djs9d2",
oauth_token="kkk9d7dh3k39sjv7",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="137131201",
oauth_nonce="7d8f3e4a",
oauth_signature="bYT5CMsGcbgUdFHObYMEfcx6bsw%3D"
c2&a3=2+q
<span class="grey">Hammer-Lahav Informational [Page 19]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-20" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
is represented by the following signature base string (line breaks
are for display purposes only):
POST&http%3A%2F%2Fexample.com%2Frequest&a2%3Dr%2520b%26a3%3D2%2520q
%26a3%3Da%26b5%3D%253D%25253D%26c%2540%3D%26c2%3D%26oauth_consumer_
key%3D9djdj82h48djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_m
ethod%3DHMAC-SHA1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk
9d7dh3k39sjv7
<span class="h5"><a class="selflink" id="section-3.4.1.2" href="#section-3.4.1.2">3.4.1.2</a>. Base String URI</span>
The scheme, authority, and path of the request resource URI [<a href="./rfc3986" title=""Uniform Resource Identifier (URI): Generic Syntax"">RFC3986</a>]
are included by constructing an "http" or "https" URI representing
the request resource (without the query or fragment) as follows:
1. The scheme and host MUST be in lowercase.
2. The host and port values MUST match the content of the HTTP
request "Host" header field.
3. The port MUST be included if it is not the default port for the
scheme, and MUST be excluded if it is the default. Specifically,
the port MUST be excluded when making an HTTP request [<a href="./rfc2616" title=""Hypertext Transfer Protocol -- HTTP/1.1"">RFC2616</a>]
to port 80 or when making an HTTPS request [<a href="./rfc2818" title=""HTTP Over TLS"">RFC2818</a>] to port 443.
All other non-default port numbers MUST be included.
For example, the HTTP request:
GET /r%20v/X?id=123 HTTP/1.1
Host: EXAMPLE.COM:80
is represented by the base string URI: "http://example.com/r%20v/X".
In another example, the HTTPS request:
GET /?q=1 HTTP/1.1
Host: www.example.net:8080
is represented by the base string URI:
"<a href="https://www.example.net:8080/">https://www.example.net:8080/</a>".
<span class="h5"><a class="selflink" id="section-3.4.1.3" href="#section-3.4.1.3">3.4.1.3</a>. Request Parameters</span>
In order to guarantee a consistent and reproducible representation of
the request parameters, the parameters are collected and decoded to
their original decoded form. They are then sorted and encoded in a
particular manner that is often different from their original
encoding scheme, and concatenated into a single string.
<span class="grey">Hammer-Lahav Informational [Page 20]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-21" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
<span class="h6"><a class="selflink" id="section-3.4.1.3.1" href="#section-3.4.1.3.1">3.4.1.3.1</a>. Parameter Sources</span>
The parameters from the following sources are collected into a single
list of name/value pairs:
o The query component of the HTTP request URI as defined by
<a href="./rfc3986#section-3.4">[RFC3986], Section 3.4</a>. The query component is parsed into a list
of name/value pairs by treating it as an
"application/x-www-form-urlencoded" string, separating the names
and values and decoding them as defined by
[<a href="#ref-W3C.REC-html40-19980424">W3C.REC-html40-19980424</a>], Section 17.13.4.
o The OAuth HTTP "Authorization" header field (<a href="#section-3.5.1">Section 3.5.1</a>) if
present. The header's content is parsed into a list of name/value
pairs excluding the "realm" parameter if present. The parameter
values are decoded as defined by <a href="#section-3.5.1">Section 3.5.1</a>.
o The HTTP request entity-body, but only if all of the following
conditions are met:
* The entity-body is single-part.
* The entity-body follows the encoding requirements of the
"application/x-www-form-urlencoded" content-type as defined by
[<a href="#ref-W3C.REC-html40-19980424">W3C.REC-html40-19980424</a>].
* The HTTP request entity-header includes the "Content-Type"
header field set to "application/x-www-form-urlencoded".
The entity-body is parsed into a list of decoded name/value pairs
as described in [<a href="#ref-W3C.REC-html40-19980424">W3C.REC-html40-19980424</a>], Section 17.13.4.
The "oauth_signature" parameter MUST be excluded from the signature
base string if present. Parameters not explicitly included in the
request MUST be excluded from the signature base string (e.g., the
"oauth_version" parameter when omitted).
<span class="grey">Hammer-Lahav Informational [Page 21]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-22" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
For example, the HTTP request:
POST /request?b5=%3D%253D&a3=a&c%40=&a2=r%20b HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded
Authorization: OAuth realm="Example",
oauth_consumer_key="9djdj82h48djs9d2",
oauth_token="kkk9d7dh3k39sjv7",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="137131201",
oauth_nonce="7d8f3e4a",
oauth_signature="djosJKDKJSD8743243%2Fjdk33klY%3D"
c2&a3=2+q
contains the following (fully decoded) parameters used in the
signature base sting:
+------------------------+------------------+
| Name | Value |
+------------------------+------------------+
| b5 | =%3D |
| a3 | a |
| c@ | |
| a2 | r b |
| oauth_consumer_key | 9djdj82h48djs9d2 |
| oauth_token | kkk9d7dh3k39sjv7 |
| oauth_signature_method | HMAC-SHA1 |
| oauth_timestamp | 137131201 |
| oauth_nonce | 7d8f3e4a |
| c2 | |
| a3 | 2 q |
+------------------------+------------------+
Note that the value of "b5" is "=%3D" and not "==". Both "c@" and
"c2" have empty values. While the encoding rules specified in this
specification for the purpose of constructing the signature base
string exclude the use of a "+" character (ASCII code 43) to
represent an encoded space character (ASCII code 32), this practice
is widely used in "application/x-www-form-urlencoded" encoded values,
and MUST be properly decoded, as demonstrated by one of the "a3"
parameter instances (the "a3" parameter is used twice in this
request).
<span class="grey">Hammer-Lahav Informational [Page 22]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-23" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
<span class="h6"><a class="selflink" id="section-3.4.1.3.2" href="#section-3.4.1.3.2">3.4.1.3.2</a>. Parameters Normalization</span>
The parameters collected in <a href="#section-3.4.1.3">Section 3.4.1.3</a> are normalized into a
single string as follows:
1. First, the name and value of each parameter are encoded
(<a href="#section-3.6">Section 3.6</a>).
2. The parameters are sorted by name, using ascending byte value
ordering. If two or more parameters share the same name, they
are sorted by their value.
3. The name of each parameter is concatenated to its corresponding
value using an "=" character (ASCII code 61) as a separator, even
if the value is empty.
4. The sorted name/value pairs are concatenated together into a
single string by using an "&" character (ASCII code 38) as
separator.
For example, the list of parameters from the previous section would
be normalized as follows:
Encoded:
+------------------------+------------------+
| Name | Value |
+------------------------+------------------+
| b5 | %3D%253D |
| a3 | a |
| c%40 | |
| a2 | r%20b |
| oauth_consumer_key | 9djdj82h48djs9d2 |
| oauth_token | kkk9d7dh3k39sjv7 |
| oauth_signature_method | HMAC-SHA1 |
| oauth_timestamp | 137131201 |
| oauth_nonce | 7d8f3e4a |
| c2 | |
| a3 | 2%20q |
+------------------------+------------------+
<span class="grey">Hammer-Lahav Informational [Page 23]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-24" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
Sorted:
+------------------------+------------------+
| Name | Value |
+------------------------+------------------+
| a2 | r%20b |
| a3 | 2%20q |
| a3 | a |
| b5 | %3D%253D |
| c%40 | |
| c2 | |
| oauth_consumer_key | 9djdj82h48djs9d2 |
| oauth_nonce | 7d8f3e4a |
| oauth_signature_method | HMAC-SHA1 |
| oauth_timestamp | 137131201 |
| oauth_token | kkk9d7dh3k39sjv7 |
+------------------------+------------------+
Concatenated Pairs:
+-------------------------------------+
| Name=Value |
+-------------------------------------+
| a2=r%20b |
| a3=2%20q |
| a3=a |
| b5=%3D%253D |
| c%40= |
| c2= |
| oauth_consumer_key=9djdj82h48djs9d2 |
| oauth_nonce=7d8f3e4a |
| oauth_signature_method=HMAC-SHA1 |
| oauth_timestamp=137131201 |
| oauth_token=kkk9d7dh3k39sjv7 |
+-------------------------------------+
and concatenated together into a single string (line breaks are for
display purposes only):
a2=r%20b&a3=2%20q&a3=a&b5=%3D%253D&c%40=&c2=&oauth_consumer_key=9dj
dj82h48djs9d2&oauth_nonce=7d8f3e4a&oauth_signature_method=HMAC-SHA1
&oauth_timestamp=137131201&oauth_token=kkk9d7dh3k39sjv7
<span class="grey">Hammer-Lahav Informational [Page 24]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-25" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
<span class="h4"><a class="selflink" id="section-3.4.2" href="#section-3.4.2">3.4.2</a>. HMAC-SHA1</span>
The "HMAC-SHA1" signature method uses the HMAC-SHA1 signature
algorithm as defined in [<a href="./rfc2104" title=""HMAC: Keyed- Hashing for Message Authentication"">RFC2104</a>]:
digest = HMAC-SHA1 (key, text)
The HMAC-SHA1 function variables are used in following way:
text is set to the value of the signature base string from
<a href="#section-3.4.1.1">Section 3.4.1.1</a>.
key is set to the concatenated values of:
1. The client shared-secret, after being encoded
(<a href="#section-3.6">Section 3.6</a>).
2. An "&" character (ASCII code 38), which MUST be included
even when either secret is empty.
3. The token shared-secret, after being encoded
(<a href="#section-3.6">Section 3.6</a>).
digest is used to set the value of the "oauth_signature" protocol
parameter, after the result octet string is base64-encoded
per <a href="./rfc2045#section-6.8">[RFC2045], Section 6.8</a>.
<span class="h4"><a class="selflink" id="section-3.4.3" href="#section-3.4.3">3.4.3</a>. RSA-SHA1</span>
The "RSA-SHA1" signature method uses the RSASSA-PKCS1-v1_5 signature
algorithm as defined in <a href="./rfc3447#section-8.2">[RFC3447], Section 8.2</a> (also known as
PKCS#1), using SHA-1 as the hash function for EMSA-PKCS1-v1_5. To
use this method, the client MUST have established client credentials
with the server that included its RSA public key (in a manner that is
beyond the scope of this specification).
The signature base string is signed using the client's RSA private
key per <a href="./rfc3447#section-8.2.1">[RFC3447], Section 8.2.1</a>:
S = RSASSA-PKCS1-V1_5-SIGN (K, M)
Where:
K is set to the client's RSA private key,
M is set to the value of the signature base string from
<a href="#section-3.4.1.1">Section 3.4.1.1</a>, and
<span class="grey">Hammer-Lahav Informational [Page 25]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-26" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
S is the result signature used to set the value of the
"oauth_signature" protocol parameter, after the result octet
string is base64-encoded per <a href="./rfc2045#section-6.8">[RFC2045] section 6.8</a>.
The server verifies the signature per <a href="./rfc3447#section-8.2.2">[RFC3447] section 8.2.2</a>:
RSASSA-PKCS1-V1_5-VERIFY ((n, e), M, S)
Where:
(n, e) is set to the client's RSA public key,
M is set to the value of the signature base string from
<a href="#section-3.4.1.1">Section 3.4.1.1</a>, and
S is set to the octet string value of the "oauth_signature"
protocol parameter received from the client.
<span class="h4"><a class="selflink" id="section-3.4.4" href="#section-3.4.4">3.4.4</a>. PLAINTEXT</span>
The "PLAINTEXT" method does not employ a signature algorithm. It
MUST be used with a transport-layer mechanism such as TLS or SSL (or
sent over a secure channel with equivalent protections). It does not
utilize the signature base string or the "oauth_timestamp" and
"oauth_nonce" parameters.
The "oauth_signature" protocol parameter is set to the concatenated
value of:
1. The client shared-secret, after being encoded (<a href="#section-3.6">Section 3.6</a>).
2. An "&" character (ASCII code 38), which MUST be included even
when either secret is empty.
3. The token shared-secret, after being encoded (<a href="#section-3.6">Section 3.6</a>).
<span class="h3"><a class="selflink" id="section-3.5" href="#section-3.5">3.5</a>. Parameter Transmission</span>
When making an OAuth-authenticated request, protocol parameters as
well as any other parameter using the "oauth_" prefix SHALL be
included in the request using one and only one of the following
locations, listed in order of decreasing preference:
1. The HTTP "Authorization" header field as described in
<a href="#section-3.5.1">Section 3.5.1</a>.
2. The HTTP request entity-body as described in <a href="#section-3.5.2">Section 3.5.2</a>.
<span class="grey">Hammer-Lahav Informational [Page 26]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-27" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
3. The HTTP request URI query as described in <a href="#section-3.5.3">Section 3.5.3</a>.
In addition to these three methods, future extensions MAY define
other methods for including protocol parameters in the request.
<span class="h4"><a class="selflink" id="section-3.5.1" href="#section-3.5.1">3.5.1</a>. Authorization Header</span>
Protocol parameters can be transmitted using the HTTP "Authorization"
header field as defined by [<a href="./rfc2617" title=""HTTP Authentication: Basic and Digest Access Authentication"">RFC2617</a>] with the auth-scheme name set to
"OAuth" (case insensitive).
For example:
Authorization: OAuth realm="Example",
oauth_consumer_key="0685bd9184jfhq22",
oauth_token="ad180jjd733klru7",
oauth_signature_method="HMAC-SHA1",
oauth_signature="wOJIO9A2W5mFwDgiDvZbTSMK%2FPY%3D",
oauth_timestamp="137131200",
oauth_nonce="4572616e48616d6d65724c61686176",
oauth_version="1.0"
Protocol parameters SHALL be included in the "Authorization" header
field as follows:
1. Parameter names and values are encoded per Parameter Encoding
(<a href="#section-3.6">Section 3.6</a>).
2. Each parameter's name is immediately followed by an "=" character
(ASCII code 61), a """ character (ASCII code 34), the parameter
value (MAY be empty), and another """ character (ASCII code 34).
3. Parameters are separated by a "," character (ASCII code 44) and
OPTIONAL linear whitespace per [<a href="./rfc2617" title=""HTTP Authentication: Basic and Digest Access Authentication"">RFC2617</a>].
4. The OPTIONAL "realm" parameter MAY be added and interpreted per
<a href="./rfc2617#section-1.2">[RFC2617] section 1.2</a>.
Servers MAY indicate their support for the "OAuth" auth-scheme by
returning the HTTP "WWW-Authenticate" response header field upon
client requests for protected resources. As per [<a href="./rfc2617" title=""HTTP Authentication: Basic and Digest Access Authentication"">RFC2617</a>], such a
response MAY include additional HTTP "WWW-Authenticate" header
fields:
For example:
WWW-Authenticate: OAuth realm="http://server.example.com/"
<span class="grey">Hammer-Lahav Informational [Page 27]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-28" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
The realm parameter defines a protection realm per [<a href="./rfc2617" title=""HTTP Authentication: Basic and Digest Access Authentication"">RFC2617</a>], <a href="#section-1.2">Section</a>
<a href="#section-1.2">1.2</a>.
<span class="h4"><a class="selflink" id="section-3.5.2" href="#section-3.5.2">3.5.2</a>. Form-Encoded Body</span>
Protocol parameters can be transmitted in the HTTP request entity-
body, but only if the following REQUIRED conditions are met:
o The entity-body is single-part.
o The entity-body follows the encoding requirements of the
"application/x-www-form-urlencoded" content-type as defined by
[<a href="#ref-W3C.REC-html40-19980424">W3C.REC-html40-19980424</a>].
o The HTTP request entity-header includes the "Content-Type" header
field set to "application/x-www-form-urlencoded".
For example (line breaks are for display purposes only):
oauth_consumer_key=0685bd9184jfhq22&oauth_token=ad180jjd733klr
u7&oauth_signature_method=HMAC-SHA1&oauth_signature=wOJIO9A2W5
mFwDgiDvZbTSMK%2FPY%3D&oauth_timestamp=137131200&oauth_nonce=4
572616e48616d6d65724c61686176&oauth_version=1.0
The entity-body MAY include other request-specific parameters, in
which case, the protocol parameters SHOULD be appended following the
request-specific parameters, properly separated by an "&" character
(ASCII code 38).
<span class="h4"><a class="selflink" id="section-3.5.3" href="#section-3.5.3">3.5.3</a>. Request URI Query</span>
Protocol parameters can be transmitted by being added to the HTTP
request URI as a query parameter as defined by <a href="./rfc3986#section-3">[RFC3986], Section 3</a>.
For example (line breaks are for display purposes only):
GET /example/path?oauth_consumer_key=0685bd9184jfhq22&
oauth_token=ad180jjd733klru7&oauth_signature_method=HM
AC-SHA1&oauth_signature=wOJIO9A2W5mFwDgiDvZbTSMK%2FPY%
3D&oauth_timestamp=137131200&oauth_nonce=4572616e48616
d6d65724c61686176&oauth_version=1.0 HTTP/1.1
The request URI MAY include other request-specific query parameters,
in which case, the protocol parameters SHOULD be appended following
the request-specific parameters, properly separated by an "&"
character (ASCII code 38).
<span class="grey">Hammer-Lahav Informational [Page 28]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-29" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
<span class="h3"><a class="selflink" id="section-3.6" href="#section-3.6">3.6</a>. Percent Encoding</span>
Existing percent-encoding methods do not guarantee a consistent
construction of the signature base string. The following percent-
encoding method is not defined to replace the existing encoding
methods defined by [<a href="./rfc3986" title=""Uniform Resource Identifier (URI): Generic Syntax"">RFC3986</a>] and [<a href="#ref-W3C.REC-html40-19980424">W3C.REC-html40-19980424</a>]. It is
used only in the construction of the signature base string and the
"Authorization" header field.
This specification defines the following method for percent-encoding
strings:
1. Text values are first encoded as UTF-8 octets per [<a href="./rfc3629" title=""UTF-8, a transformation format of ISO 10646"">RFC3629</a>] if
they are not already. This does not include binary values that
are not intended for human consumption.
2. The values are then escaped using the [<a href="./rfc3986" title=""Uniform Resource Identifier (URI): Generic Syntax"">RFC3986</a>] percent-encoding
(%XX) mechanism as follows:
* Characters in the unreserved character set as defined by
<a href="./rfc3986#section-2.3">[RFC3986], Section 2.3</a> (ALPHA, DIGIT, "-", ".", "_", "~") MUST
NOT be encoded.
* All other characters MUST be encoded.
* The two hexadecimal characters used to represent encoded
characters MUST be uppercase.
This method is different from the encoding scheme used by the
"application/x-www-form-urlencoded" content-type (for example, it
encodes space characters as "%20" and not using the "+" character).
It MAY be different from the percent-encoding functions provided by
web-development frameworks (e.g., encode different characters, use
lowercase hexadecimal characters).
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Security Considerations</span>
As stated in [<a href="./rfc2617" title=""HTTP Authentication: Basic and Digest Access Authentication"">RFC2617</a>], the greatest sources of risks are usually
found not in the core protocol itself but in policies and procedures
surrounding its use. Implementers are strongly encouraged to assess
how this protocol addresses their security requirements.
<span class="h3"><a class="selflink" id="section-4.1" href="#section-4.1">4.1</a>. RSA-SHA1 Signature Method</span>
Authenticated requests made with "RSA-SHA1" signatures do not use the
token shared-secret, or any provisioned client shared-secret. This
means the request relies completely on the secrecy of the private key
used by the client to sign requests.
<span class="grey">Hammer-Lahav Informational [Page 29]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-30" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
<span class="h3"><a class="selflink" id="section-4.2" href="#section-4.2">4.2</a>. Confidentiality of Requests</span>
While this protocol provides a mechanism for verifying the integrity
of requests, it provides no guarantee of request confidentiality.
Unless further precautions are taken, eavesdroppers will have full
access to request content. Servers should carefully consider the
kinds of data likely to be sent as part of such requests, and should
employ transport-layer security mechanisms to protect sensitive
resources.
<span class="h3"><a class="selflink" id="section-4.3" href="#section-4.3">4.3</a>. Spoofing by Counterfeit Servers</span>
This protocol makes no attempt to verify the authenticity of the
server. A hostile party could take advantage of this by intercepting
the client's requests and returning misleading or otherwise incorrect
responses. Service providers should consider such attacks when
developing services using this protocol, and should require
transport-layer security for any requests where the authenticity of
the server or of request responses is an issue.
<span class="h3"><a class="selflink" id="section-4.4" href="#section-4.4">4.4</a>. Proxying and Caching of Authenticated Content</span>
The HTTP Authorization scheme (<a href="#section-3.5.1">Section 3.5.1</a>) is optional. However,
[<a href="./rfc2616" title=""Hypertext Transfer Protocol -- HTTP/1.1"">RFC2616</a>] relies on the "Authorization" and "WWW-Authenticate" header
fields to distinguish authenticated content so that it can be
protected. Proxies and caches, in particular, may fail to adequately
protect requests not using these header fields.
For example, private authenticated content may be stored in (and thus
retrievable from) publicly accessible caches. Servers not using the
HTTP "Authorization" header field should take care to use other
mechanisms, such as the "Cache-Control" header field, to ensure that
authenticated content is protected.
<span class="h3"><a class="selflink" id="section-4.5" href="#section-4.5">4.5</a>. Plaintext Storage of Credentials</span>
The client shared-secret and token shared-secret function the same
way passwords do in traditional authentication systems. In order to
compute the signatures used in methods other than "RSA-SHA1", the
server must have access to these secrets in plaintext form. This is
in contrast, for example, to modern operating systems, which store
only a one-way hash of user credentials.
If an attacker were to gain access to these secrets -- or worse, to
the server's database of all such secrets -- he or she would be able
to perform any action on behalf of any resource owner. Accordingly,
it is critical that servers protect these secrets from unauthorized
access.
<span class="grey">Hammer-Lahav Informational [Page 30]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-31" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
<span class="h3"><a class="selflink" id="section-4.6" href="#section-4.6">4.6</a>. Secrecy of the Client Credentials</span>
In many cases, the client application will be under the control of
potentially untrusted parties. For example, if the client is a
desktop application with freely available source code or an
executable binary, an attacker may be able to download a copy for
analysis. In such cases, attackers will be able to recover the
client credentials.
Accordingly, servers should not use the client credentials alone to
verify the identity of the client. Where possible, other factors
such as IP address should be used as well.
<span class="h3"><a class="selflink" id="section-4.7" href="#section-4.7">4.7</a>. Phishing Attacks</span>
Wide deployment of this and similar protocols may cause resource
owners to become inured to the practice of being redirected to
websites where they are asked to enter their passwords. If resource
owners are not careful to verify the authenticity of these websites
before entering their credentials, it will be possible for attackers
to exploit this practice to steal resource owners' passwords.
Servers should attempt to educate resource owners about the risks
phishing attacks pose, and should provide mechanisms that make it
easy for resource owners to confirm the authenticity of their sites.
Client developers should consider the security implications of how
they interact with a user-agent (e.g., separate window, embedded),
and the ability of the end-user to verify the authenticity of the
server website.
<span class="h3"><a class="selflink" id="section-4.8" href="#section-4.8">4.8</a>. Scoping of Access Requests</span>
By itself, this protocol does not provide any method for scoping the
access rights granted to a client. However, most applications do
require greater granularity of access rights. For example, servers
may wish to make it possible to grant access to some protected
resources but not others, or to grant only limited access (such as
read-only access) to those protected resources.
When implementing this protocol, servers should consider the types of
access resource owners may wish to grant clients, and should provide
mechanisms to do so. Servers should also take care to ensure that
resource owners understand the access they are granting, as well as
any risks that may be involved.
<span class="grey">Hammer-Lahav Informational [Page 31]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-32" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
<span class="h3"><a class="selflink" id="section-4.9" href="#section-4.9">4.9</a>. Entropy of Secrets</span>
Unless a transport-layer security protocol is used, eavesdroppers
will have full access to authenticated requests and signatures, and
will thus be able to mount offline brute-force attacks to recover the
credentials used. Servers should be careful to assign shared-secrets
that are long enough, and random enough, to resist such attacks for
at least the length of time that the shared-secrets are valid.
For example, if shared-secrets are valid for two weeks, servers
should ensure that it is not possible to mount a brute force attack
that recovers the shared-secret in less than two weeks. Of course,
servers are urged to err on the side of caution, and use the longest
secrets reasonable.
It is equally important that the pseudo-random number generator
(PRNG) used to generate these secrets be of sufficiently high
quality. Many PRNG implementations generate number sequences that
may appear to be random, but that nevertheless exhibit patterns or
other weaknesses that make cryptanalysis or brute force attacks
easier. Implementers should be careful to use cryptographically
secure PRNGs to avoid these problems.
<span class="h3"><a class="selflink" id="section-4.10" href="#section-4.10">4.10</a>. Denial-of-Service / Resource-Exhaustion Attacks</span>
This specification includes a number of features that may make
resource exhaustion attacks against servers possible. For example,
this protocol requires servers to track used nonces. If an attacker
is able to use many nonces quickly, the resources required to track
them may exhaust available capacity. And again, this protocol can
require servers to perform potentially expensive computations in
order to verify the signature on incoming requests. An attacker may
exploit this to perform a denial-of-service attack by sending a large
number of invalid requests to the server.
Resource Exhaustion attacks are by no means specific to this
specification. However, implementers should be careful to consider
the additional avenues of attack that this protocol exposes, and
design their implementations accordingly. For example, 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. When implementing this protocol, servers should
consider which of these presents a more serious risk for their
application and design accordingly.
<span class="grey">Hammer-Lahav Informational [Page 32]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-33" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
<span class="h3"><a class="selflink" id="section-4.11" href="#section-4.11">4.11</a>. SHA-1 Cryptographic Attacks</span>
SHA-1, the hash algorithm used in "HMAC-SHA1" and "RSA-SHA1"
signature methods, has been shown to have a number of cryptographic
weaknesses that significantly reduce its resistance to collision
attacks. While these weaknesses do not seem to affect the use of
SHA-1 with the Hash-based Message Authentication Code (HMAC) and
should not affect the "HMAC-SHA1" signature method, it may affect the
use of the "RSA-SHA1" signature method. NIST has announced that it
will phase out use of SHA-1 in digital signatures by 2010
[<a href="#ref-NIST_SHA-1Comments">NIST_SHA-1Comments</a>].
Practically speaking, these weaknesses are difficult to exploit, and
by themselves do not pose a significant risk to users of this
protocol. They may, however, make more efficient attacks possible,
and servers should take this into account when considering whether
SHA-1 provides an adequate level of security for their applications.
<span class="h3"><a class="selflink" id="section-4.12" href="#section-4.12">4.12</a>. Signature Base String Limitations</span>
The signature base string has been designed to support the signature
methods defined in this specification. Those designing additional
signature methods, should evaluated the compatibility of the
signature base string with their security requirements.
Since the signature base string does not cover the entire HTTP
request, such as most request entity-body, most entity-headers, and
the order in which parameters are sent, servers should employ
additional mechanisms to protect such elements.
<span class="h3"><a class="selflink" id="section-4.13" href="#section-4.13">4.13</a>. Cross-Site Request Forgery (CSRF)</span>
Cross-Site Request Forgery (CSRF) is a web-based attack whereby HTTP
requests are transmitted from a user that the website trusts or has
authenticated. CSRF attacks on authorization approvals can allow an
attacker to obtain authorization to protected resources without the
consent of the User. Servers SHOULD strongly consider best practices
in CSRF prevention at all the protocol authorization endpoints.
CSRF attacks on OAuth callback URIs hosted by clients are also
possible. Clients should prevent CSRF attacks on OAuth callback URIs
by verifying that the resource owner at the client site intended to
complete the OAuth negotiation with the server. The methods for
preventing such CSRF attacks are beyond the scope of this
specification.
<span class="grey">Hammer-Lahav Informational [Page 33]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-34" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
<span class="h3"><a class="selflink" id="section-4.14" href="#section-4.14">4.14</a>. User Interface Redress</span>
Servers should protect the authorization process against user
interface (UI) redress attacks (also known as "clickjacking"). As of
the time of this writing, no complete defenses against UI redress are
available. Servers can mitigate the risk of UI redress attacks using
the following techniques:
o JavaScript frame busting.
o JavaScript frame busting, and requiring that browsers have
JavaScript enabled on the authorization page.
o Browser-specific anti-framing techniques.
o Requiring password reentry before issuing OAuth tokens.
<span class="h3"><a class="selflink" id="section-4.15" href="#section-4.15">4.15</a>. Automatic Processing of Repeat Authorizations</span>
Servers may wish to automatically process authorization requests
(<a href="#section-2.2">Section 2.2</a>) from clients that have been previously authorized by
the resource owner. When the resource owner is redirected to the
server to grant access, the server detects that the resource owner
has already granted access to that particular client. Instead of
prompting the resource owner for approval, the server automatically
redirects the resource owner back to the client.
If the client credentials are compromised, automatic processing
creates additional security risks. An attacker can use the stolen
client credentials to redirect the resource owner to the server with
an authorization request. The server will then grant access to the
resource owner's data without the resource owner's explicit approval,
or even awareness of an attack. If no automatic approval is
implemented, an attacker must use social engineering to convince the
resource owner to approve access.
Servers can mitigate the risks associated with automatic processing
by limiting the scope of token credentials obtained through automated
approvals. Tokens credentials obtained through explicit resource
owner consent can remain unaffected. Clients can mitigate the risks
associated with automatic processing by protecting their client
credentials.
<span class="grey">Hammer-Lahav Informational [Page 34]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-35" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Acknowledgments</span>
This specification is directly based on the OAuth Core 1.0 Revision A
community specification, which in turn was modeled after existing
proprietary protocols and best practices that have been independently
implemented by various companies.
The community specification was edited by Eran Hammer-Lahav and
authored by: Mark Atwood, Dirk Balfanz, Darren Bounds, Richard M.
Conlan, Blaine Cook, Leah Culver, Breno de Medeiros, Brian Eaton,
Kellan Elliott-McCrea, Larry Halff, Eran Hammer-Lahav, Ben Laurie,
Chris Messina, John Panzer, Sam Quigley, David Recordon, Eran
Sandler, Jonathan Sergent, Todd Sieling, Brian Slesinsky, and Andy
Smith.
The editor would like to thank the following individuals for their
invaluable contribution to the publication of this edition of the
protocol: Lisa Dusseault, Justin Hart, Avshalom Houri, Chris Messina,
Mark Nottingham, Tim Polk, Peter Saint-Andre, Joseph Smarr, and Paul
Walker.
<span class="grey">Hammer-Lahav Informational [Page 35]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-36" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
<span class="h2"><a class="selflink" id="appendix-A" href="#appendix-A">Appendix A</a>. Differences from the Community Edition</span>
This specification includes the following changes made to the
original community document [<a href="#ref-OAuthCore1.0_RevisionA">OAuthCore1.0_RevisionA</a>] in order to
correct mistakes and omissions identified since the document was
originally published at <<a href="http://oauth.net">http://oauth.net</a>>.
o Changed using TLS/SSL when sending or requesting plain text
credentials from SHOULD to MUST. This change affects any use of
the "PLAINTEXT" signature method, as well as requesting temporary
credentials (<a href="#section-2.1">Section 2.1</a>) and obtaining token credentials
(<a href="#section-2.3">Section 2.3</a>).
o Adjusted nonce language to indicate it is unique per token/
timestamp/client combination.
o Removed the requirement for timestamps to be equal to or greater
than the timestamp used in the previous request.
o Changed the nonce and timestamp parameters to OPTIONAL when using
the "PLAINTEXT" signature method.
o Extended signature base string coverage that includes
"application/x-www-form-urlencoded" entity-body parameters when
the HTTP method used is other than "POST" and URI query parameters
when the HTTP method used is other than "GET".
o Incorporated corrections to the instructions in each signature
method to encode the signature value before inserting it into the
"oauth_signature" parameter, removing errors that would have
caused double-encoded values.
o Allowed omitting the "oauth_token" parameter when empty.
o Permitted sending requests for temporary credentials with an empty
"oauth_token" parameter.
o Removed the restrictions from defining additional "oauth_"
parameters.
<span class="grey">Hammer-Lahav Informational [Page 36]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-37" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. References</span>
<span class="h3"><a class="selflink" id="section-6.1" href="#section-6.1">6.1</a>. Normative References</span>
[<a id="ref-RFC2045">RFC2045</a>] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
Extensions (MIME) Part One: Format of Internet Message
Bodies", <a href="./rfc2045">RFC 2045</a>, November 1996.
[<a id="ref-RFC2104">RFC2104</a>] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed-
Hashing for Message Authentication", <a href="./rfc2104">RFC 2104</a>,
February 1997.
[<a id="ref-RFC2119">RFC2119</a>] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>, March 1997.
[<a id="ref-RFC2616">RFC2616</a>] Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
Transfer Protocol -- HTTP/1.1", <a href="./rfc2616">RFC 2616</a>, June 1999.
[<a id="ref-RFC2617">RFC2617</a>] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S.,
Leach, P., Luotonen, A., and L. Stewart, "HTTP
Authentication: Basic and Digest Access Authentication",
<a href="./rfc2617">RFC 2617</a>, June 1999.
[<a id="ref-RFC2818">RFC2818</a>] Rescorla, E., "HTTP Over TLS", <a href="./rfc2818">RFC 2818</a>, May 2000.
[<a id="ref-RFC3447">RFC3447</a>] Jonsson, J. and B. Kaliski, "Public-Key Cryptography
Standards (PKCS) #1: RSA Cryptography Specifications
Version 2.1", <a href="./rfc3447">RFC 3447</a>, February 2003.
[<a id="ref-RFC3629">RFC3629</a>] Yergeau, F., "UTF-8, a transformation format of ISO
10646", STD 63, <a href="./rfc3629">RFC 3629</a>, November 2003.
[<a id="ref-RFC3986">RFC3986</a>] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifier (URI): Generic Syntax", STD 66,
<a href="./rfc3986">RFC 3986</a>, January 2005.
[<a id="ref-W3C.REC-html40-19980424">W3C.REC-html40-19980424</a>]
Hors, A., Raggett, D., and I. Jacobs, "HTML 4.0
Specification", World Wide Web Consortium
Recommendation REC-html40-19980424, April 1998,
<<a href="http://www.w3.org/TR/1998/REC-html40-19980424">http://www.w3.org/TR/1998/REC-html40-19980424</a>>.
<span class="grey">Hammer-Lahav Informational [Page 37]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-38" ></span>
<span class="grey"><a href="./rfc5849">RFC 5849</a> OAuth 1.0 April 2010</span>
<span class="h3"><a class="selflink" id="section-6.2" href="#section-6.2">6.2</a>. Informative References</span>
[<a id="ref-NIST_SHA-1Comments">NIST_SHA-1Comments</a>]
Burr, W., "NIST Comments on Cryptanalytic Attacks on
SHA-1",
<<a href="http://csrc.nist.gov/groups/ST/hash/statement.html">http://csrc.nist.gov/groups/ST/hash/statement.html</a>>.
[<a id="ref-OAuthCore1.0_RevisionA">OAuthCore1.0_RevisionA</a>]
OAuth Community, "OAuth Core 1.0 Revision A",
<<a href="http://oauth.net/core/1.0a">http://oauth.net/core/1.0a</a>>.
Author's Address
Eran Hammer-Lahav (editor)
EMail: eran@hueniverse.com
URI: <a href="http://hueniverse.com">http://hueniverse.com</a>
Hammer-Lahav Informational [Page 38]
</pre>
|