OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// A client library for authenticating with a remote service via OAuth2 on | 5 /// A client library for authenticating with a remote service via OAuth2 on |
6 /// behalf of a user, and making authorized HTTP requests with the user's OAuth2 | 6 /// behalf of a user, and making authorized HTTP requests with the user's OAuth2 |
7 /// credentials. | 7 /// credentials. |
8 /// | 8 /// |
| 9 /// ## Installing ## |
| 10 /// |
| 11 /// Use [pub][] to install this package. Add the following to your |
| 12 /// `pubspec.yaml` file. |
| 13 /// |
| 14 /// dependencies: |
| 15 /// oauth2: any |
| 16 /// |
| 17 /// Then run `pub install`. |
| 18 /// |
| 19 /// For more information, see the |
| 20 /// [oauth2 package on pub.dartlang.org][pkg]. |
| 21 /// |
9 /// OAuth2 allows a client (the program using this library) to access and | 22 /// OAuth2 allows a client (the program using this library) to access and |
10 /// manipulate a resource that's owned by a resource owner (the end user) and | 23 /// manipulate a resource that's owned by a resource owner (the end user) and |
11 /// lives on a remote server. The client directs the resource owner to an | 24 /// lives on a remote server. The client directs the resource owner to an |
12 /// authorization server (usually but not always the same as the server that | 25 /// authorization server (usually but not always the same as the server that |
13 /// hosts the resource), where the resource owner tells the authorization server | 26 /// hosts the resource), where the resource owner tells the authorization server |
14 /// to give the client an access token. This token serves as proof that the | 27 /// to give the client an access token. This token serves as proof that the |
15 /// client has permission to access resources on behalf of the resource owner. | 28 /// client has permission to access resources on behalf of the resource owner. |
16 /// | 29 /// |
17 /// OAuth2 provides several different methods for the client to obtain | 30 /// OAuth2 provides several different methods for the client to obtain |
18 /// authorization. At the time of writing, this library only supports the | 31 /// authorization. At the time of writing, this library only supports the |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 /// .then((result) { | 106 /// .then((result) { |
94 /// // Once we're done with the client, save the credentials file. This | 107 /// // Once we're done with the client, save the credentials file. This |
95 /// // ensures that if the credentials were automatically refreshed | 108 /// // ensures that if the credentials were automatically refreshed |
96 /// // while using the client, the new credentials are available for the | 109 /// // while using the client, the new credentials are available for the |
97 /// // next run of the program. | 110 /// // next run of the program. |
98 /// return credentialsFile.open(FileMode.WRITE).then((file) { | 111 /// return credentialsFile.open(FileMode.WRITE).then((file) { |
99 /// return file.writeString(client.credentials.toJson()); | 112 /// return file.writeString(client.credentials.toJson()); |
100 /// }).then((file) => file.close()).then((_) => result); | 113 /// }).then((file) => file.close()).then((_) => result); |
101 /// }); | 114 /// }); |
102 /// }).then(print); | 115 /// }).then(print); |
| 116 /// |
| 117 /// [pub]: http://pub.dartlang.org |
| 118 /// [pkg]: http://pub.dartlang.org/packages/oauth2 |
103 library oauth2; | 119 library oauth2; |
104 | 120 |
105 export 'src/authorization_code_grant.dart'; | 121 export 'src/authorization_code_grant.dart'; |
106 export 'src/client.dart'; | 122 export 'src/client.dart'; |
107 export 'src/credentials.dart'; | 123 export 'src/credentials.dart'; |
108 export 'src/authorization_exception.dart'; | 124 export 'src/authorization_exception.dart'; |
109 export 'src/expiration_exception.dart'; | 125 export 'src/expiration_exception.dart'; |
OLD | NEW |