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 +11 -0
- package/dist/Client.js +34 -30
- package/dist/FileStorage.d.ts +1 -1
- package/dist/FileStorage.js +0 -1
- package/dist/TokenStorage.d.ts +1 -1
- package/package.json +1 -1
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
|
-
|
|
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(
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
59
62
|
const code_verifier = OpenIDClient.randomPKCECodeVerifier();
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
}
|
package/dist/FileStorage.d.ts
CHANGED
package/dist/FileStorage.js
CHANGED
package/dist/TokenStorage.d.ts
CHANGED
package/package.json
CHANGED