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 +1 -1
- package/src/commands/login.js +6 -7
package/package.json
CHANGED
package/src/commands/login.js
CHANGED
|
@@ -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
|
-
//
|
|
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
|
-
|
|
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
|
-
//
|
|
110
|
-
|
|
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) + '...' });
|