@dosu/cli 0.35.3 → 0.35.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.
Files changed (2) hide show
  1. package/bin/dosu.js +20 -9
  2. package/package.json +1 -1
package/bin/dosu.js CHANGED
@@ -2098,17 +2098,24 @@ var init_commander = __esm(() => {
2098
2098
  });
2099
2099
 
2100
2100
  // src/config/identity.ts
2101
- function getAccessTokenUserID(accessToken) {
2101
+ function getAccessTokenClaim(accessToken, claim) {
2102
2102
  try {
2103
2103
  const payload = accessToken.split(".")[1];
2104
2104
  if (!payload)
2105
2105
  return;
2106
2106
  const decoded = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
2107
- return typeof decoded.sub === "string" && decoded.sub.length > 0 ? decoded.sub : undefined;
2107
+ const value = decoded[claim];
2108
+ return typeof value === "string" && value.length > 0 ? value : undefined;
2108
2109
  } catch {
2109
2110
  return;
2110
2111
  }
2111
2112
  }
2113
+ function getAccessTokenUserID(accessToken) {
2114
+ return getAccessTokenClaim(accessToken, "sub");
2115
+ }
2116
+ function getAccessTokenOAuthClientID(accessToken) {
2117
+ return getAccessTokenClaim(accessToken, "client_id");
2118
+ }
2112
2119
 
2113
2120
  // src/config/schema.ts
2114
2121
  var MODE_OSS = "oss", CONFIG_SCHEMA_VERSION = 2;
@@ -2452,14 +2459,18 @@ class Client {
2452
2459
  if (!session?.refresh_token)
2453
2460
  throw new Error("no refresh token available");
2454
2461
  const supabaseURL = getSupabaseURL();
2455
- const endpoint = `${supabaseURL}/auth/v1/token?grant_type=refresh_token`;
2462
+ const oauthClientID = getAccessTokenOAuthClientID(session.access_token);
2463
+ const endpoint = oauthClientID ? `${supabaseURL}/auth/v1/oauth/token` : `${supabaseURL}/auth/v1/token?grant_type=refresh_token`;
2464
+ const headers = oauthClientID ? { "Content-Type": "application/x-www-form-urlencoded" } : { "Content-Type": "application/json", apikey: getSupabaseAnonKey() };
2465
+ const body = oauthClientID ? new URLSearchParams({
2466
+ grant_type: "refresh_token",
2467
+ refresh_token: session.refresh_token,
2468
+ client_id: oauthClientID
2469
+ }).toString() : JSON.stringify({ refresh_token: session.refresh_token });
2456
2470
  const resp = await fetch(endpoint, {
2457
2471
  method: "POST",
2458
- headers: {
2459
- "Content-Type": "application/json",
2460
- apikey: getSupabaseAnonKey()
2461
- },
2462
- body: JSON.stringify({ refresh_token: session.refresh_token })
2472
+ headers,
2473
+ body
2463
2474
  });
2464
2475
  if (resp.status !== 200) {
2465
2476
  throw new Error(`refresh failed with status ${resp.status}`);
@@ -4748,7 +4759,7 @@ var init_dist4 = __esm(() => {
4748
4759
  function getVersionString() {
4749
4760
  return `v${VERSION}`;
4750
4761
  }
4751
- var VERSION = "0.35.3", INSTALL_CHANNEL = "npm";
4762
+ var VERSION = "0.35.4", INSTALL_CHANNEL = "npm";
4752
4763
 
4753
4764
  // src/debug/logger.ts
4754
4765
  import {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosu/cli",
3
- "version": "0.35.3",
3
+ "version": "0.35.4",
4
4
  "type": "module",
5
5
  "description": "Dosu CLI - Manage MCP servers for AI tools",
6
6
  "license": "MIT",