securegate-cli-tool 2.1.2 → 2.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securegate-cli-tool",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "SecureGate CLI — Secure your AI agent API keys from the terminal",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -98,16 +98,15 @@ async function loginCommand() {
98
98
  // We must fetch the user profile securely given the access token
99
99
  spinner.text = 'Verifying session...';
100
100
 
101
- // Set the initial auth context in the API client to make requests
102
- // We manually overwrite the globally configured client to bypass normal auth requirement
101
+ // Create a minimal Supabase client for auth verification only
103
102
  const { createClient } = require('@supabase/supabase-js');
104
- api.supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY, {
105
- auth: { persistSession: false },
106
- global: { headers: { Authorization: `Bearer ${payload.access_token}` } }
103
+ const supabaseAuth = createClient(SUPABASE_URL, SUPABASE_ANON_KEY, {
104
+ auth: { persistSession: false }
107
105
  });
108
106
 
109
- // Request user data using the new token to confirm it's valid and get email
110
- const { data: { user }, error } = await api.supabase.auth.getUser();
107
+ // Pass the JWT directly to getUser() this is the correct server-side pattern
108
+ // It tells Supabase to verify this specific token rather than looking for a session
109
+ const { data: { user }, error } = await supabaseAuth.auth.getUser(payload.access_token);
111
110
 
112
111
  if (error || !user) {
113
112
  console.error("\n[DEBUG] getUser failed:", { error, user, access_token: payload.access_token.substring(0, 15) + '...' });