You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34-17Lines changed: 34 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,3 @@
1
-
2
-
3
1
<!--
4
2
This README describes the package. If you publish this package to pub.dev,
5
3
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
17
15
18
16
## Features
19
17
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.
21
23
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.
23
26
24
27
**Currently it supports the following grants:**
28
+
25
29
- ✅ ResourceOwnerPasswordGrant
26
30
- ✅ ClientCredentialsGrant
27
31
- ❌ AuthorizationCodeGrant (*TODO*)
@@ -35,21 +39,34 @@ Request a OAuthGrant on the `oauth_chopper` client.
35
39
Example:
36
40
37
41
```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
+
);
50
65
```
51
66
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):
0 commit comments