forked from nov/draft-ietf-oauth
-
Notifications
You must be signed in to change notification settings - Fork 1
/
draft-ietf-oauth-v2.txt
2353 lines (1465 loc) · 82 KB
/
draft-ietf-oauth-v2.txt
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
Network Working Group E. Hammer-Lahav, Ed.
Internet-Draft Yahoo!
Intended status: Standards Track D. Recordon
Expires: December 31, 2010 Facebook
D. Hardt
Microsoft
June 29, 2010
The OAuth 2.0 Protocol
draft-ietf-oauth-v2-09
Abstract
This specification describes the OAuth 2.0 protocol.
Status of this Memo
This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."
This Internet-Draft will expire on December 31, 2010.
Copyright Notice
Copyright (c) 2010 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) 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.
Hammer-Lahav, et al. Expires December 31, 2010 [Page 1]
Internet-Draft OAuth 2.0 June 2010
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1. Notational Conventions . . . . . . . . . . . . . . . . . . 5
1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 5
1.3. Overview . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.4. Client Profiles . . . . . . . . . . . . . . . . . . . . . 9
1.4.1. Web Server . . . . . . . . . . . . . . . . . . . . . . 10
1.4.2. User-Agent . . . . . . . . . . . . . . . . . . . . . . 11
1.4.3. Native Application . . . . . . . . . . . . . . . . . . 13
1.4.4. Autonomous . . . . . . . . . . . . . . . . . . . . . . 14
2. Client Credentials . . . . . . . . . . . . . . . . . . . . . . 14
2.1. Basic Client Credentials . . . . . . . . . . . . . . . . . 15
3. Obtaining End-User Authorization . . . . . . . . . . . . . . . 16
3.1. Authorization Response . . . . . . . . . . . . . . . . . . 18
3.2. Error Response . . . . . . . . . . . . . . . . . . . . . . 20
3.2.1. Error Codes . . . . . . . . . . . . . . . . . . . . . 21
4. Obtaining an Access Token . . . . . . . . . . . . . . . . . . 21
4.1. Access Grant Types . . . . . . . . . . . . . . . . . . . . 22
4.1.1. Authorization Code . . . . . . . . . . . . . . . . . . 23
4.1.2. Resource Owner Basic Credentials . . . . . . . . . . . 23
4.1.3. Assertion . . . . . . . . . . . . . . . . . . . . . . 24
4.1.4. Refresh Token . . . . . . . . . . . . . . . . . . . . 25
4.2. Access Token Response . . . . . . . . . . . . . . . . . . 25
4.3. Error Response . . . . . . . . . . . . . . . . . . . . . . 27
4.3.1. Error Codes . . . . . . . . . . . . . . . . . . . . . 27
5. Accessing a Protected Resource . . . . . . . . . . . . . . . . 28
5.1. Authenticated Requests . . . . . . . . . . . . . . . . . . 29
5.1.1. The Authorization Request Header Field . . . . . . . . 29
5.1.2. URI Query Parameter . . . . . . . . . . . . . . . . . 29
5.1.3. Form-Encoded Body Parameter . . . . . . . . . . . . . 30
5.2. The WWW-Authenticate Response Header Field . . . . . . . . 31
5.2.1. Error Codes . . . . . . . . . . . . . . . . . . . . . 32
6. Extensibility . . . . . . . . . . . . . . . . . . . . . . . . 33
6.1. Defining New Client Credentials Types . . . . . . . . . . 33
6.2. Defining New Endpoint Parameters . . . . . . . . . . . . . 33
6.3. Defining New Header Field Parameters . . . . . . . . . . . 34
6.4. Defining New Access Grant Types . . . . . . . . . . . . . 34
7. Security Considerations . . . . . . . . . . . . . . . . . . . 34
8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 34
8.1. The OAuth Parameters Registry . . . . . . . . . . . . . . 34
8.1.1. Registration Template . . . . . . . . . . . . . . . . 35
8.1.2. Example . . . . . . . . . . . . . . . . . . . . . . . 35
Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 36
Appendix B. Contributors . . . . . . . . . . . . . . . . . . . . 36
Appendix C. Acknowledgements . . . . . . . . . . . . . . . . . . 36
Appendix D. Document History . . . . . . . . . . . . . . . . . . 36
9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Hammer-Lahav, et al. Expires December 31, 2010 [Page 2]
Internet-Draft OAuth 2.0 June 2010
9.1. Normative References . . . . . . . . . . . . . . . . . . . 40
9.2. Informative References . . . . . . . . . . . . . . . . . . 41
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 42
Hammer-Lahav, et al. Expires December 31, 2010 [Page 3]
Internet-Draft OAuth 2.0 June 2010
1. Introduction
With the increasing use of distributed web services and cloud
computing, third-party applications require access to server-hosted
resources. These resources are usually protected and require
authentication using the resource owner's credentials (typically a
username and password).
In the traditional client-server authentication model, the client
accesses a protected resource on the server by presenting the
resource owner's credentials in order to authenticate and gain
access. OAuth introduces a third role to the traditional model: the
resource owner. In OAuth, the client (which is usually not the
resource owner, but is acting on its behalf) requests access to
resources controlled by the resource owner and hosted by the resource
server.
In addition to removing the need for resource owners to share their
credentials, resource owners require the ability to restrict access
to a limited subset of the resources they control, to limit access
duration, or to limit access to the methods supported by these
resources.
Instead of using the resource owner's credentials to access protected
resources, clients obtain an access token (a string which denotes a
specific scope, duration, and other attributes). The format and
structure of access tokens is beyond the scope of this specification.
Tokens are issued to third-party clients by an authorization server
with the approval of the resource owner. The client uses the access
token to access the protected resources hosted by the resource
server. The interaction between the authorization server and
resource server is beyond the scope of this specification.
For example, a web user (resource owner) can grant a printing service
(client) access to her protected photos stored at a photo sharing
service (resource server), without sharing her username and password
with the printing service. Instead, she authenticates directly with
the photo sharing service (authorization server) which issues the
printing service delegation-specific credentials (token).
This specification defines the use of OAuth over HTTP [RFC2616] (or
HTTP over TLS as defined by [RFC2818]). Other specifications may
extend it for use with other transport protocols.
Hammer-Lahav, et al. Expires December 31, 2010 [Page 4]
Internet-Draft OAuth 2.0 June 2010
1.1. Notational Conventions
The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL NOT',
'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'MAY', and 'OPTIONAL' in this
document are to be interpreted as described in [RFC2119].
This document uses the Augmented Backus-Naur Form (ABNF) notation of
[I-D.ietf-httpbis-p1-messaging]. Additionally, the following rules
are included from [RFC2617]: realm, auth-param; from [RFC3986]: URI-
Reference; and from [I-D.ietf-httpbis-p1-messaging]: OWS, RWS, and
quoted-string.
Unless otherwise noted, all the protocol parameter names and values
are case sensitive.
1.2. Terminology
protected resource
An access-restricted resource which can be obtained using an
OAuth-authenticated request.
resource server
A server capable of accepting and responding to protected
resource requests.
client
An application obtaining authorization and making protected
resource requests.
resource owner
An entity capable of granting access to a protected resource.
end-user
A human resource owner.
token
A string representing an access authorization issued to the
client. The string is usually opaque to the client and can
self-contain the authorization information in a verifiable
manner (i.e. signed), or denotes an identifier used to retrieve
the information. Tokens represent a specific scope, duration,
and other authorization attributes granted by the resource
owner and enforced by the resource server and authorization
servers.
Hammer-Lahav, et al. Expires December 31, 2010 [Page 5]
Internet-Draft OAuth 2.0 June 2010
access token
A token used by the client to make authenticated requests
on behalf of the resource owner.
refresh token
A token used by the client to obtain a new access token
without having to involve the resource owner.
authorization code A short-lived token representing the access
grant provided by the end-user. The authorization code
is used to obtain an access token and a refresh token.
authorization server
A server capable of issuing tokens after successfully
authenticating the resource owner and obtaining authorization.
The authorization server may be the same server as the resource
server, or a separate entity.
end-user authorization endpoint
The authorization server's HTTP endpoint capable of
authenticating the end-user and obtaining authorization. The
end-user authorization endpoint is described in Section 3.
token endpoint
The authorization server's HTTP endpoint capable of issuing
tokens and refreshing expired tokens. The token endpoint is
described in Section 4.
client identifier
An unique identifier issued to the client to identify itself to
the authorization server. Client identifiers may have a
matching secret. The client identifier is described in
Section 2.
1.3. Overview
OAuth provides a method for clients to access a protected resource on
behalf of a resource owner. Before a client can access a protected
resource, it must first obtain authorization from the resource owner,
then exchange the access grant for an access token (representing the
grant's scope, duration, and other attributes). The client accesses
the protected resource by presenting the access token to the resource
server.
Hammer-Lahav, et al. Expires December 31, 2010 [Page 6]
Internet-Draft OAuth 2.0 June 2010
+--------+ +---------------+
| |--(A)-- Authorization Request --->| Resource |
| | | Owner |
| |<-(B)------ Access Grant ---------| |
| | +---------------+
| |
| | Client Credentials & +---------------+
| |--(C)------ Access Grant -------->| Authorization |
| Client | | Server |
| |<-(D)------ Access Token ---------| |
| | (w/ Optional Refresh Token) +---------------+
| |
| | +---------------+
| |--(E)------ Access Token -------->| Resource |
| | | Server |
| |<-(F)---- Protected Resource -----| |
+--------+ +---------------+
Figure 1: Abstract Protocol Flow
The abstract flow illustrated in Figure 1 includes the following
steps:
(A) The client requests authorization from the resource owner. The
client should not interact directly with the resource owner
(since that would expose the resource owner's credentials to the
client), but instead request authorization via an authorization
server or other entities. For example, the client directs the
resource owner to the authorization server which in turn issues
it an access grant. When unavoidable, the client interacts
directly with the end-user, asking for the end-user's username
and password. If the client is acting autonomously, the
authorization request is beyond the scope of this specification.
(B) The client is issued an access grant which represents the
authorization provided by the resource owner. The access grant
can be expressed as:
* Authorization code - an access grant obtained via an
authorization server. The process used to obtain an
authorization code utilized the end-user's user-agent and is
described in Section 3.
* Assertion - an access grant obtained using a different trust
framework. Assertions enable the client to utilize existing
trust relationships to obtain an access token. They provide
a bridge between OAuth and other trust frameworks. The
Hammer-Lahav, et al. Expires December 31, 2010 [Page 7]
Internet-Draft OAuth 2.0 June 2010
access grant represented by an assertion depends on the
assertion type, its content, and how it was issued, which are
beyond the scope of this specification.
* Resource owner basic credentials - obtained when interacting
directly with a resource-owner. Resource owner basic
credentials (i.e. a username and password) should only be
used when there is a high degree of trust between the
resource owner and the client (e.g. its computer operating
system or a highly privileged application). However, unlike
the HTTP Basic authentication scheme defined in [RFC2617],
the resource owner's credentials are used for a single
request and are exchanged for an access token and refresh
token. This eliminates the need for the client to store the
resource-owner's credentials for future use.
(C) The client requests an access token by authenticating with the
authorization server, and presenting the access grant. The
token request is described in Section 4.
(D) The authorization server validates the client credentials and
the access grant, and issues an access token with an optional
refresh token. Access tokens usually have a shorter lifetime
than the access grant. Refresh tokens usually have a lifetime
equal to the duration of the access grant. When an access token
expires, the refresh token is used to obtain a new access token
without having to request another access grant from the resource
owner.
(E) The client makes a protected resource request to the resource
server, and presents the access token in order to gain access.
Accessing a protected resource is described in Section 5.
(F) The resource server validates the access token, and if valid,
serves the request.
When the client is acting on its own behalf (the client is also the
resource owner), the client does not obtain an access grant. The
simplified protocol flow is illustrated in Figure 2:
Hammer-Lahav, et al. Expires December 31, 2010 [Page 8]
Internet-Draft OAuth 2.0 June 2010
+--------+ +---------------+
| |--(C)--- Client Credentials ----->| Authorization |
| | | Server |
| |<-(D)------ Access Token ---------| |
| | (w/ Optional Refresh Token) +---------------+
| Client |
| | +---------------+
| |--(E)------ Access Token -------->| Resource |
| | | Server |
| |<-(F)---- Protected Resource -----| |
+--------+ +---------------+
Figure 2: Protocol Flow for Client Acting On Its Own Behalf
When the client uses the user-agent profile (described in
Section 1.4.2), the authorization request results in an access token,
as illustrated in Figure 3:
+--------+ +----------+ +---------------+
| |--(A)-- Authorization --+- -+-->| |
| | Request | Resource | | Authorization |
| | | Owner | | Server |
| |<-(D)-- Access Token ---+- -+---| |
| | +----------+ +---------------+
| Client |
| | +---------------+
| |--(E)-------- Access Token ----------->| Resource |
| | | Server |
| |<-(F)------ Protected Resource --------| |
+--------+ +---------------+
Figure 3: Indirect Access Grant Protocol Flow
1.4. Client Profiles
OAuth supports a wide range of client types by providing a rich and
extensible framework for establishing authorization and exchanging it
for an access token. The methods detailed in this specification were
designed to accommodate four client types: web servers, user-agents,
native applications, and autonomous clients. Additional
authorization flows and client profiles may be defined by other
specifications to cover additional scenarios and client types.
Hammer-Lahav, et al. Expires December 31, 2010 [Page 9]
Internet-Draft OAuth 2.0 June 2010
1.4.1. Web Server
The web server profile is suitable for clients capable of interacting
with the end-user's user-agent (typically a web browser) and capable
of receiving incoming requests from the authorization server (capable
of acting as an HTTP server).
+----------+ Client Identifier +---------------+
| -+----(A)--- & Redirect URI ------>| |
| End-user | | Authorization |
| at |<---(B)-- User authenticates --->| Server |
| Browser | | |
| -+----(C)-- Authorization Code ---<| |
+-|----|---+ +---------------+
| | ^ v
(A) (C) | |
| | | |
^ v | |
+---------+ | |
| |>---(D)-- Client Credentials, --------' |
| Web | Authorization Code, |
| Client | & Redirect URI |
| | |
| |<---(E)----- Access Token -------------------'
+---------+ (w/ Optional Refresh Token)
Figure 4: Web Server Flow
The web server flow illustrated in Figure 4 includes the following
steps:
(A) The web client initiates the flow by redirecting the end-user's
user-agent to the end-user authorization endpoint as described
in Section 3 The client includes its client identifier,
requested scope, local state, and a redirect URI to which the
authorization server will send the end-user back once access is
granted (or denied).
(B) The authorization server authenticates the end-user (via the
user-agent) and establishes whether the end-user grants or
denies the client's access request.
(C) Assuming the end-user granted access, the authorization server
redirects the user-agent back to the client to the redirection
URI provided earlier. The authorization includes an
authorization code for the client to use to obtain an access
Hammer-Lahav, et al. Expires December 31, 2010 [Page 10]
Internet-Draft OAuth 2.0 June 2010
token.
(D) The client requests an access token from the authorization
server by authenticating and including the authorization code
received in the previous step as described in Section 4.
(E) The authorization server validates the client credentials and
the authorization code and responds back with the access token.
1.4.2. User-Agent
The user-agent profile is suitable for client applications residing
in a user-agent, typically implemented in a browser using a scripting
language such as JavaScript. These clients cannot keep client
secrets confidential and the authentication of the client is based on
the user-agent's same-origin policy.
Unlike other profiles in which the client makes a separate end-user
authorization request and an access token requests, the client
receives the access token as a result of the end-user authorization
request in the form of an HTTP redirection. The client requests the
authorization server to redirect the user-agent to another web server
or local resource accessible to the user-agent which is capable of
extracting the access token from the response and passing it to the
client.
This user-agent profile does not utilize the client secret since the
client executables reside on the end-user's computer or device which
makes the client secret accessible and exploitable. Because the
access token is encoded into the redirection URI, it may be exposed
to the end-user and other applications residing on the computer or
device.
Hammer-Lahav, et al. Expires December 31, 2010 [Page 11]
Internet-Draft OAuth 2.0 June 2010
+----------+ Client Identifier +----------------+
| |>---(A)-- & Redirection URI --->| |
| | | |
End <--+ - - - +----(B)-- User authenticates -->| Authorization |
User | | | Server |
| |<---(C)--- Redirect URI -------<| |
| Client | with Access Token | |
| in | in Fragment +----------------+
| Browser |
| | +----------------+
| |>---(D)--- Redirect URI ------->| |
| | without Fragment | Web Server |
| | | with Client |
| (F) |<---(E)--- Web Page with ------<| Resource |
| Access | Script | |
| Token | +----------------+
+----------+
Figure 5: User-Agent Flow
The user-agent flow illustrated in Figure 5 includes the following
steps:
(A) The client sends the user-agent to the end-user authorization
endpoint as described in Section 3. The client includes its
client identifier, requested scope, local state, and a redirect
URI to which the authorization server will send the end-user
back once authorization is granted (or denied).
(B) The authorization server authenticates the end-user (via the
user-agent) and establishes whether the end-user grants or
denies the client's access request.
(C) If the end-user granted access, the authorization server
redirects the user-agent to the redirection URI provided
earlier. The redirection URI includes the access token in the
URI fragment.
(D) The user-agent follows the redirection instructions by making a
request to the web server which does not include the fragment.
The user-agent retains the fragment information locally.
(E) The web server returns a web page (typically an HTML page with
an embedded script) capable of accessing the full redirection
URI including the fragment retained by the user-agent, and
extracting the access token (and other parameters) contained in
the fragment.
Hammer-Lahav, et al. Expires December 31, 2010 [Page 12]
Internet-Draft OAuth 2.0 June 2010
(F) The user-agent executes the script provided by the web server
locally, which extracts the access token and passes it to the
client.
1.4.3. Native Application
Native application are clients running as native code on the end-
user's computer or device (i.e. executing outside a user-agent or as
a desktop program). These clients are often capable of interacting
with (or embedding) the end-user's user-agent but are limited in how
such interaction affects their end-user experience. In many cases,
native applications are incapable of receiving direct callback
requests from the server (e.g. firewall, operating system
restrictions).
Native application clients can be implemented in different ways based
on their requirements and desired end-user experience. Native
application clients can:
o Utilize the end-user authorization endpoint as described in
Section 3 by launching an external user-agent. The client can
capture the response by providing a redirection URI with a custom
URI scheme (registered with the operating system to invoke the
client application), or by providing a redirection URI pointing to
a server-hosted resource under the client's control which makes
the response available to the client (e.g. using the window title
or other locations accessible from outside the user-agent).
o Utilize the end-user authorization endpoint as described in
Section 3 by using an embedded user-agent. The client obtains the
response by directly communicating with the embedded user-agent.
o Prompt end-users for their basic credentials (username and
password) and use them directly to obtain an access token. This
is generally discouraged as it hands the end-user's password
directly to the 3rd party and is limited to basic credentials.
When choosing between launching an external browser and an embedded
user-agent, developers should consider the following:
o External user-agents may improve completion rate as the end-user
may already be logged-in and not have to re-authenticate.
o Embedded user-agents often offer a better end-user flow, as they
remove the need to switch context and open new windows.
o Embedded user-agents pose a security challenge because users are
authenticating in an unidentified window without access to the
Hammer-Lahav, et al. Expires December 31, 2010 [Page 13]
Internet-Draft OAuth 2.0 June 2010
visual protections offered by many user-agents.
1.4.4. Autonomous
Autonomous clients utilize an existing trust relationship or
framework to establish authorization. Autonomous clients can be
implemented in different ways based on their requirements and the
existing trust framework they rely upon. Autonomous clients can:
o Obtain an access token by authenticating with the authorization
server using their client credentials. The scope of the access
token is limited to the protected resources under the control of
the client, or that of another resource owner previously arranged
with the authorization server.
o Use an existing access grant expressed as an assertion using an
assertion format supported by the authorization server. Using
assertions requires the client to obtain a assertion (such as a
SAML [OASIS.saml-core-2.0-os] assertion) from an assertion issuer
or to self-issue an assertion. The assertion format, the process
by which the assertion is obtained, and the method of validating
the assertion are defined by the assertion issuer and the
authorization server, and are beyond the scope of this
specification.
2. Client Credentials
When interacting with the authorization server, the client identifies
itself using a set of client credentials. The client credentials
include a client identifier and MAY include a secret or other means
for the authorization server to authenticate the client.
The means through which the client obtains its credentials are beyond
the scope of this specification, but usually involve registration
with the authorization server. [[ OAuth Discovery provides one way of
obtaining basic client credentials ]]
Due to the nature of some clients, authorization servers SHOULD NOT
make assumptions about the confidentiality of client credentials
without establishing trust with the client operator. Authorization
servers SHOULD NOT issue client secrets to clients incapable of
keeping their secrets confidential.
This specification provides one mechanism for authenticating the
client using a set of basic client credentials. The authorization
server MAY authenticate the client using any desired authentication
scheme.
Hammer-Lahav, et al. Expires December 31, 2010 [Page 14]
Internet-Draft OAuth 2.0 June 2010
The client MUST NOT include more than one set of client credentials
with each request, and MUST NOT utilize more than one mechanism to
authenticate each request (regardless whether the credentials are
identical).
2.1. Basic Client Credentials
The basic client credentials include a client identifier and an
OPTIONAL matching shared symmetric secret. The client identifier and
secret are included in the request using the HTTP Basic
authentication scheme as defined in [RFC2617] by including the client
identifier as the username and secret as the password.
For example (line breaks are for display purposes only):
POST /token HTTP/1.1
Host: server.example.com
Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
Content-Type: application/x-www-form-urlencoded
type=web-server&code=i1WsRn1uB1&
redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb
Alternatively, the client MAY include the credentials using the
following request parameters:
client_id
REQUIRED. The client identifier.
client_secret REQUIRED if the client identifier has a matching
secret.
For example (line breaks are for display purposes only):
POST /token HTTP/1.1
Host: server.example.com
Content-Type: application/x-www-form-urlencoded
type=web-server&client_id=s6BhdRkqt3&
client_secret=gX1fBat3bV&code=i1WsRn1uB1&
redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb
The authorization server MUST accept the client credentials using
both the request parameters, and the HTTP Basic authentication
Hammer-Lahav, et al. Expires December 31, 2010 [Page 15]
Internet-Draft OAuth 2.0 June 2010
scheme. The authorization server MAY support additional
authentication schemes suitable for the transmission of a username
and password.
3. Obtaining End-User Authorization
When the client interacts with an end-user, the end-user MUST first
grant the client authorization to access its protected resources.
Once obtained, the end-user access grant is expressed as an
authorization code which the client uses to obtain an access token.
To obtain an end-user authorization, the client sends the end-user to
the end-user authorization endpoint.
At the end-user authorization endpoint, the end-user first
authenticates with the authorization server, and then grants or
denies the access request. The way in which the authorization server
authenticates the end-user (e.g. username and password login, OpenID,
session cookies) and in which the authorization server obtains the
end-user's authorization, including whether it uses a secure channel
such as TLS, is beyond the scope of this specification. However, the
authorization server MUST first verify the identity of the end-user.
The location of the end-user authorization endpoint can be found in
the service documentation, or can be obtained by using [[ OAuth
Discovery ]]. The end-user authorization endpoint URI MAY include a
query component as defined by [RFC3986] section 3, which must be
retained when adding additional query parameters.
Since requests to the end-user authorization endpoint result in user
authentication and the transmission of sensitive information, the
authorization server SHOULD require the use of a transport-layer
security mechanism such as TLS when sending requests to the end-user
authorization endpoint.
In order to direct the end-user's user-agent to the authorization
server, the client constructs the request URI by adding the following
parameters to the end-user authorization endpoint URI query component
using the "application/x-www-form-urlencoded" format as defined by
[W3C.REC-html401-19991224]:
response_type
REQUIRED. The requested response: an access token, an
authorization code, or both. The parameter value MUST be set
to "token" for requesting an access token, "code" for
requesting an authorization code, or "code-and-token" to
request both. The authorization server MAY decline to provide
one or more of these response types. [[ The 'code-and-token'
Hammer-Lahav, et al. Expires December 31, 2010 [Page 16]
Internet-Draft OAuth 2.0 June 2010
type is pending use cases and may be removed for the
specification ]]
client_id
REQUIRED. The client identifier as described in Section 2.
redirect_uri
REQUIRED, unless a redirection URI has been established between
the client and authorization server via other means. An
absolute URI to which the authorization server will redirect
the user-agent to when the end-user authorization step is
completed. The authorization server SHOULD require the client
to pre-register their redirection URI.
scope
OPTIONAL. The scope of the access request expressed as a list
of space-delimited strings. The value of the "scope" parameter
is defined by the authorization server. If the value contains
multiple space-delimited strings, their order does not matter,
and each string adds an additional access range to the
requested scope.
state
OPTIONAL. An opaque value used by the client to maintain state
between the request and callback. The authorization server
includes this value when redirecting the user-agent back to the
client.
The client directs the end-user to the constructed URI using an HTTP
redirection response, or by other means available to it via the end-
user's user-agent. The request MUST use the HTTP "GET" method.
For example, the client directs the end-user's user-agent to make the
following HTTP request using transport-layer security (line breaks
are for display purposes only):
GET /authorize?response_type=code&client_id=s6BhdRkqt3&
redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb HTTP/1.1
Host: server.example.com
If the client has previously registered a redirection URI with the
authorization server, the authorization server MUST verify that the
redirection URI received matches the registered URI associated with
the client identifier. [[ provide guidance on how to perform matching
]]
Hammer-Lahav, et al. Expires December 31, 2010 [Page 17]
Internet-Draft OAuth 2.0 June 2010
Parameters sent without a value MUST be treated as if they were
omitted from the request.
The authorization server validates the request to ensure all required
parameters are present and valid. If the request is invalid, the
authorization server immediately redirects the user-agent back to the
client using the redirection URI provided with the appropriate error
code as described in Section 3.2.
The authorization server authenticates the end-user and obtains an
authorization decision (by asking the end-user or by establishing
approval via other means). When a decision has been established, the
authorization server directs the end-user's user-agent to the
provided client redirection URI using an HTTP redirection response,
or by other means available to it via the end-user's user-agent.
3.1. Authorization Response
If the end-user grants the access request, the authorization server
issues an access token, an authorization code, or both, and delivers
them to the client by adding the following parameters to the
redirection URI (as described below):
code
REQUIRED if the response type is "token" or "code-and-token",
otherwise MUST NOT be included. The authorization code
generated by the authorization server. The authorization code
SHOULD expire shortly after it is issued. The authorization
server MUST invalidate the authorization code after a single
usage. The authorization code is bound to the client
identifier and redirection URI.
access_token
REQUIRED if the response type is "token" or "code-and-token",
otherwise MUST NOT be included. The access token.
expires_in
OPTIONAL. The duration in seconds of the access token lifetime
if an access token is included. For example, the value "3600"
denotes that the access token will expire in one hour from the
time the response was generated by the authorization server.
scope
OPTIONAL. The scope of the access token as a list of space-
delimited strings if an access token is included. The value of