@linktr.ee/create-link-app 2.2.2 → 2.2.4
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/dist/commands/login.js
CHANGED
|
@@ -110,7 +110,7 @@ async function loginCommand(options) {
|
|
|
110
110
|
const token = await (0, device_auth_1.pollAccessToken)(handle);
|
|
111
111
|
s.stop('Authentication successful');
|
|
112
112
|
if ((0, access_token_1.isTokenValid)(token)) {
|
|
113
|
-
(0, access_token_1.saveAccessToken)(token.access_token);
|
|
113
|
+
(0, access_token_1.saveAccessToken)(token.access_token, config.auth.audience);
|
|
114
114
|
(0, write_line_1.writeLine)(picocolors_1.default.green('✓ Login successful'));
|
|
115
115
|
if (token.expires_at) {
|
|
116
116
|
(0, write_line_1.writeLine)(picocolors_1.default.dim(` Token expires at ${new Date(token.expires_at * 1000).toString()}`));
|
|
@@ -36,10 +36,14 @@ function isTokenValid(token) {
|
|
|
36
36
|
return true;
|
|
37
37
|
}
|
|
38
38
|
exports.isTokenValid = isTokenValid;
|
|
39
|
-
function saveAccessToken(tokenString) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
function saveAccessToken(tokenString, audience) {
|
|
40
|
+
if (!audience) {
|
|
41
|
+
// Fallback: derive from JWT aud claim (backward compat for external callers)
|
|
42
|
+
const token = jsonwebtoken_1.default.decode(tokenString, { json: true });
|
|
43
|
+
const rawAudience = token?.aud;
|
|
44
|
+
audience = Array.isArray(rawAudience) ? rawAudience[0] : rawAudience;
|
|
45
|
+
}
|
|
46
|
+
if (audience) {
|
|
43
47
|
netrc_parser_1.default.loadSync();
|
|
44
48
|
netrc_parser_1.default.machines[audience] = {
|
|
45
49
|
login: 'authToken',
|
package/oclif.manifest.json
CHANGED