Skip to content

Commit 3bafdca

Browse files
committed
Updated README.md
1 parent 2f3e19f commit 3bafdca

File tree

1 file changed

+34
-17
lines changed

1 file changed

+34
-17
lines changed

README.md

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
<!--
42
This README describes the package. If you publish this package to pub.dev,
53
this README's contents appear on the landing page for your package.
@@ -17,11 +15,17 @@ Add and manage OAuth2 authentication for your Chopper client
1715

1816
## Features
1917

20-
Offers a `oauth_chopper` client to help manage your OAuth2 authentication with [Choppper](https://pub.dev/packages/chopper). The `oauth_chopper` client uses [oauth2](https://pub.dev/packages/oauth2) package from the dart team and combines this with Chopper. It offers a Chopper Authenticator and HeaderInterceptor to manage the OAuth2 authorizations.
18+
Offers a `oauth_chopper` client to help manage your OAuth2 authentication
19+
with [Choppper](https://pub.dev/packages/chopper). The `oauth_chopper` client
20+
uses [oauth2](https://pub.dev/packages/oauth2) package from the dart team and combines this with
21+
Chopper. It offers a Chopper Authenticator and HeaderInterceptor to manage the OAuth2
22+
authorizations.
2123

22-
By default it doesn't persist any credential information. It uses an in memory storage by default. This can be override by providing a custom storage implementation.
24+
By default it doesn't persist any credential information. It uses an in memory storage by default.
25+
This can be override by providing a custom storage implementation.
2326

2427
**Currently it supports the following grants:**
28+
2529
- ✅ ResourceOwnerPasswordGrant
2630
- ✅ ClientCredentialsGrant
2731
- ❌ AuthorizationCodeGrant (*TODO*)
@@ -35,21 +39,34 @@ Request a OAuthGrant on the `oauth_chopper` client.
3539
Example:
3640

3741
```dart
38-
/// Create OAuthChopper instance.
39-
final oauthChopper = OAuthChopper( authorizationEndpoint: authorizationEndpoint,
40-
identifier: identifier,
41-
secret: secret,
42-
); /// Add the oauth authenticator and interceptor to the chopper client. final chopperClient = ChopperClient(
43-
baseUrl: 'https://example.com',
44-
authenticator: oauthChopper.authenticator(),
45-
interceptors: [ oauthChopper.interceptor, ], ); /// Request grant oauthChopper.requestGrant(
46-
ResourceOwnerPasswordGrant(
47-
username: 'username',
48-
password: 'password',
49-
), );
42+
/// Create OAuthChopper instance.
43+
final oauthChopper = OAuthChopper(
44+
authorizationEndpoint: authorizationEndpoint,
45+
identifier: identifier,
46+
secret: secret,
47+
);
48+
49+
/// Add the oauth authenticator and interceptor to the chopper client.
50+
final chopperClient = ChopperClient(
51+
baseUrl: 'https://example.com',
52+
authenticator: oauthChopper.authenticator(),
53+
interceptors: [
54+
oauthChopper.interceptor,
55+
],
56+
);
57+
58+
/// Request grant
59+
oauthChopper.requestGrant(
60+
ResourceOwnerPasswordGrant(
61+
username: 'username',
62+
password: 'password',
63+
),
64+
);
5065
```
5166

52-
If you want to persist the OAuth2 credential information you can provide a custom OAuthStorage implementation for example with [flutter_secure_storage](https://pub.dev/packages/flutter_secure_storage):
67+
If you want to persist the OAuth2 credential information you can provide a custom OAuthStorage
68+
implementation for example
69+
with [flutter_secure_storage](https://pub.dev/packages/flutter_secure_storage):
5370

5471
```dart
5572
const _storageKey = 'storage_key';

0 commit comments

Comments
 (0)