rest-client-sdk 7.3.0 → 7.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -106,6 +106,27 @@ browser environment and
106
106
  [React Native AsyncStorage](https://facebook.github.io/react-native/docs/asyncstorage.html)
107
107
  for React Native.
108
108
 
109
+ ##### Authorization code flow with PKCE
110
+
111
+ `AuthorizationCodeFlowTokenGenerator` supports [PKCE](https://datatracker.ietf.org/doc/html/rfc7636). The SDK does not generate the `code_verifier` nor the `code_challenge`: generate them before redirecting to the authorize endpoint, then pass the verifier with the received `code`. `clientSecret` is optional, omit it for a public client.
112
+
113
+ ```js
114
+ import {
115
+ AuthorizationCodeFlowTokenGenerator,
116
+ TokenStorage,
117
+ } from 'rest-client-sdk';
118
+
119
+ const tokenGenerator = new AuthorizationCodeFlowTokenGenerator({
120
+ path: 'oauth.me/token',
121
+ scheme: 'https',
122
+ clientId: 'my-client-id',
123
+ redirectUri: 'https://my.app/callback',
124
+ });
125
+ const tokenStorage = new TokenStorage(tokenGenerator, storage);
126
+
127
+ await tokenStorage.generateToken({ code, codeVerifier });
128
+ ```
129
+
109
130
  #### Configure the SDK
110
131
 
111
132
  ```js