@shad-claiborne/basic-oidc 1.1.4 → 1.1.6

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
@@ -1,3 +1,4 @@
1
+ # This package is not intended for production environments.
1
2
  ```ts
2
3
  const issuer = 'https://id.some-idp.com';
3
4
  const provider:IdentityProvider = await createIdentityProvider(issuer);
package/dist/index.d.ts CHANGED
@@ -261,16 +261,19 @@ export declare class Client {
261
261
  /**
262
262
  * requestAccess
263
263
  * @param authResponse AuthorizationResponse
264
- * @param codeVerifier string
264
+ * @param args object
265
265
  * @returns Promise<TokenResponse>
266
266
  */
267
- requestAccess(authResponse: AuthorizationResponse, codeVerifier?: string): Promise<TokenResponse>;
267
+ requestAccess(authResponse: AuthorizationResponse, params?: {
268
+ redirectUri?: string;
269
+ codeVerifier?: string;
270
+ }): Promise<TokenResponse>;
268
271
  /**
269
272
  * refreshAccess
270
273
  * @param tokenSet TokenSet
271
- * @returns Promise<TokenSet>
274
+ * @returns Promise<TokenResponse>
272
275
  */
273
- refreshAccess(tokenSet: TokenSet): Promise<TokenSet>;
276
+ refreshAccess(tokenSet: TokenSet): Promise<TokenResponse>;
274
277
  /**
275
278
  * revokeAccess
276
279
  * @param tokenSet TokenSet
package/dist/index.js CHANGED
@@ -431,24 +431,26 @@ class Client {
431
431
  /**
432
432
  * requestAccess
433
433
  * @param authResponse AuthorizationResponse
434
- * @param codeVerifier string
434
+ * @param args object
435
435
  * @returns Promise<TokenResponse>
436
436
  */
437
- async requestAccess(authResponse, codeVerifier) {
437
+ async requestAccess(authResponse, params = {}) {
438
438
  const tokenRequest = new TokenRequest(this);
439
439
  if (authResponse.code === undefined)
440
440
  throw new Error('authorization response did not include a code');
441
441
  tokenRequest.setCode(authResponse.code)
442
442
  .setGrantType('authorization_code');
443
- if (codeVerifier)
444
- tokenRequest.setCodeVerifier(codeVerifier);
443
+ if (params.redirectUri)
444
+ tokenRequest.setRedirectUri(params.redirectUri);
445
+ if (params.codeVerifier)
446
+ tokenRequest.setCodeVerifier(params.codeVerifier);
445
447
  const res = await axios_1.default.post(this.provider.getTokenEndpoint(), tokenRequest.toURLSearchParams());
446
448
  return res.data;
447
449
  }
448
450
  /**
449
451
  * refreshAccess
450
452
  * @param tokenSet TokenSet
451
- * @returns Promise<TokenSet>
453
+ * @returns Promise<TokenResponse>
452
454
  */
453
455
  async refreshAccess(tokenSet) {
454
456
  if (tokenSet.refresh_token === undefined)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shad-claiborne/basic-oidc",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Basic OpenID Connect library",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",