Chromium Code Reviews| 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 `pubspec.yaml ` | |
|
Andrei Mouravski
2013/04/19 20:13:35
Line too long.
sethladd
2013/04/19 20:32:43
Done.
| |
| 12 /// file. | |
| 13 /// | |
| 14 /// dependencies: | |
| 15 /// oauth2: any | |
| 16 /// | |
| 17 /// And then run `pub install`. | |
| 18 /// | |
| 9 /// OAuth2 allows a client (the program using this library) to access and | 19 /// 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 | 20 /// 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 | 21 /// 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 | 22 /// authorization server (usually but not always the same as the server that |
| 13 /// hosts the resource), where the resource owner tells the authorization server | 23 /// 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 | 24 /// 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. | 25 /// client has permission to access resources on behalf of the resource owner. |
| 16 /// | 26 /// |
| 17 /// OAuth2 provides several different methods for the client to obtain | 27 /// OAuth2 provides several different methods for the client to obtain |
| 18 /// authorization. At the time of writing, this library only supports the | 28 /// 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) { | 103 /// .then((result) { |
| 94 /// // Once we're done with the client, save the credentials file. This | 104 /// // Once we're done with the client, save the credentials file. This |
| 95 /// // ensures that if the credentials were automatically refreshed | 105 /// // ensures that if the credentials were automatically refreshed |
| 96 /// // while using the client, the new credentials are available for the | 106 /// // while using the client, the new credentials are available for the |
| 97 /// // next run of the program. | 107 /// // next run of the program. |
| 98 /// return credentialsFile.open(FileMode.WRITE).then((file) { | 108 /// return credentialsFile.open(FileMode.WRITE).then((file) { |
| 99 /// return file.writeString(client.credentials.toJson()); | 109 /// return file.writeString(client.credentials.toJson()); |
| 100 /// }).then((file) => file.close()).then((_) => result); | 110 /// }).then((file) => file.close()).then((_) => result); |
| 101 /// }); | 111 /// }); |
| 102 /// }).then(print); | 112 /// }).then(print); |
| 113 /// | |
| 114 /// [pub]: http://pub.dartlang.org | |
| 103 library oauth2; | 115 library oauth2; |
| 104 | 116 |
| 105 export 'src/authorization_code_grant.dart'; | 117 export 'src/authorization_code_grant.dart'; |
| 106 export 'src/client.dart'; | 118 export 'src/client.dart'; |
| 107 export 'src/credentials.dart'; | 119 export 'src/credentials.dart'; |
| 108 export 'src/authorization_exception.dart'; | 120 export 'src/authorization_exception.dart'; |
| 109 export 'src/expiration_exception.dart'; | 121 export 'src/expiration_exception.dart'; |
| OLD | NEW |