oauth2-cli 0.2.3 → 0.3.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/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [0.3.0](https://github.com/battis/oauth2-cli/compare/oauth2-cli/0.2.3...oauth2-cli/0.3.0) (2025-12-24)
6
+
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * resolve 1Password secret references successfully
11
+
12
+ ### Bug Fixes
13
+
14
+ * resolve 1Password secret references successfully ([c4446e1](https://github.com/battis/oauth2-cli/commit/c4446e197a66271dac3ea8d58ff44725cc6be1db))
15
+
5
16
  ## [0.2.3](https://github.com/battis/oauth2-cli/compare/oauth2-cli/0.2.2...oauth2-cli/0.2.3) (2025-12-23)
6
17
 
7
18
 
package/dist/Client.js CHANGED
@@ -42,7 +42,10 @@ export class Client {
42
42
  if ((freshTokens = Token.fromResponse(await OpenIDClient.refreshTokenGrant(await Configuration.acquire(this.options), token.refresh_token, parameters,
43
43
  // @ts-expect-error 2322 undocumented arg pass-through to oauth4webapi
44
44
  { headers }), token.refresh_token))) {
45
- return this.store?.save(freshTokens) || freshTokens;
45
+ if (this.store) {
46
+ await this.store.save(freshTokens);
47
+ }
48
+ return freshTokens;
46
49
  }
47
50
  }
48
51
  return this.authorize();
@@ -55,36 +58,37 @@ export class Client {
55
58
  }
56
59
  async authorize() {
57
60
  const { scope, redirect_uri, parameters: additionalParameters } = this.options;
58
- return new Promise(async (resolve, reject) => {
61
+ return new Promise((resolve, reject) => {
59
62
  const code_verifier = OpenIDClient.randomPKCECodeVerifier();
60
- const code_challenge = await OpenIDClient.calculatePKCECodeChallenge(code_verifier);
61
- let state = undefined;
62
- const parameters = {
63
- ...additionalParameters,
64
- redirect_uri,
65
- code_challenge,
66
- code_challenge_method: 'S256' // TODO make code challenge method configurable?
67
- };
68
- if (scope) {
69
- parameters.scope = scope;
70
- }
71
- if (!(await this.getConfiguration()).serverMetadata().supportsPKCE()) {
72
- state = OpenIDClient.randomState();
73
- parameters.state = state;
74
- }
75
- await Localhost.redirectServer({
76
- ...this.options,
77
- authorization_url: OpenIDClient.buildAuthorizationUrl(await this.getConfiguration(), parameters).href,
78
- code_verifier,
79
- state,
80
- resolve: (async (response) => {
81
- this.token = Token.fromResponse(response);
82
- if (this.token && this.store) {
83
- await this.store.save(this.token);
84
- }
85
- resolve(this.token);
86
- }).bind(this),
87
- reject
63
+ OpenIDClient.calculatePKCECodeChallenge(code_verifier).then(async (code_challenge) => {
64
+ let state = undefined;
65
+ const parameters = {
66
+ ...additionalParameters,
67
+ redirect_uri,
68
+ code_challenge,
69
+ code_challenge_method: 'S256' // TODO make code challenge method configurable?
70
+ };
71
+ if (scope) {
72
+ parameters.scope = scope;
73
+ }
74
+ if (!(await this.getConfiguration()).serverMetadata().supportsPKCE()) {
75
+ state = OpenIDClient.randomState();
76
+ parameters.state = state;
77
+ }
78
+ await Localhost.redirectServer({
79
+ ...this.options,
80
+ authorization_url: OpenIDClient.buildAuthorizationUrl(await this.getConfiguration(), parameters).href,
81
+ code_verifier,
82
+ state,
83
+ resolve: (async (response) => {
84
+ this.token = Token.fromResponse(response);
85
+ if (this.token && this.store) {
86
+ await this.store.save(this.token);
87
+ }
88
+ resolve(this.token);
89
+ }).bind(this),
90
+ reject
91
+ });
88
92
  });
89
93
  });
90
94
  }
@@ -5,5 +5,5 @@ export declare class FileStorage implements TokenStorage {
5
5
  private readonly filePath;
6
6
  constructor(filePath: string);
7
7
  load(): Promise<Token | undefined>;
8
- save(tokens: Token): Promise<Token>;
8
+ save(tokens: Token): Promise<void>;
9
9
  }
@@ -24,6 +24,5 @@ export class FileStorage {
24
24
  }
25
25
  fs.writeFileSync(this.filePath, JSON.stringify(tokens));
26
26
  }).bind(this));
27
- return tokens;
28
27
  }
29
28
  }
@@ -1,5 +1,5 @@
1
1
  import { Token } from './Token.js';
2
2
  export interface TokenStorage {
3
3
  load(): Promise<Token | undefined>;
4
- save(tokens: Token): Promise<Token>;
4
+ save(tokens: Token): Promise<void>;
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oauth2-cli",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "Acquire API access tokens via OAuth 2.0 within CLI tools",
5
5
  "homepage": "https://github.com/battis/oauth2-cli/tree/main/packages/oauth2-cli#readme",
6
6
  "repository": {