@linktr.ee/create-link-app 2.2.3 → 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.
@@ -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,11 +36,14 @@ function isTokenValid(token) {
36
36
  return true;
37
37
  }
38
38
  exports.isTokenValid = isTokenValid;
39
- function saveAccessToken(tokenString) {
40
- const token = jsonwebtoken_1.default.decode(tokenString, { json: true });
41
- const rawAudience = token?.aud;
42
- const audience = Array.isArray(rawAudience) ? rawAudience[0] : rawAudience;
43
- if (audience && typeof audience === 'string') {
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) {
44
47
  netrc_parser_1.default.loadSync();
45
48
  netrc_parser_1.default.machines[audience] = {
46
49
  login: 'authToken',
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.2.3",
2
+ "version": "2.2.4",
3
3
  "commands": {
4
4
  "build": {
5
5
  "id": "build",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linktr.ee/create-link-app",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "Create a Link App on Linktr.ee.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Linktree",