@pebblehouse/odin-cli 0.3.0 → 0.3.1
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/index.js +10 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -104,6 +104,14 @@ import { Command } from "commander";
|
|
|
104
104
|
import { createClient } from "@supabase/supabase-js";
|
|
105
105
|
var SUPABASE_URL = process.env.ODIN_SUPABASE_URL ?? "https://vdiwtiiksdyhlibqrngw.supabase.co";
|
|
106
106
|
var SUPABASE_ANON_KEY = process.env.ODIN_SUPABASE_ANON_KEY ?? "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZkaXd0aWlrc2R5aGxpYnFybmd3Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzM2ODM4NDksImV4cCI6MjA4OTI1OTg0OX0.gAccODqqhBnL_npqG7H42EvaT2CWR1P2pqo5NVjKFas";
|
|
107
|
+
function createNodeClient() {
|
|
108
|
+
return createClient(SUPABASE_URL, SUPABASE_ANON_KEY, {
|
|
109
|
+
auth: {
|
|
110
|
+
autoRefreshToken: false,
|
|
111
|
+
persistSession: false
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
107
115
|
async function getValidToken() {
|
|
108
116
|
const creds = getCredentials();
|
|
109
117
|
if (!creds) {
|
|
@@ -113,9 +121,8 @@ async function getValidToken() {
|
|
|
113
121
|
if (creds.expires_at > now + 60) {
|
|
114
122
|
return creds.access_token;
|
|
115
123
|
}
|
|
116
|
-
const supabase =
|
|
117
|
-
const { data, error } = await supabase.auth.
|
|
118
|
-
access_token: creds.access_token,
|
|
124
|
+
const supabase = createNodeClient();
|
|
125
|
+
const { data, error } = await supabase.auth.refreshSession({
|
|
119
126
|
refresh_token: creds.refresh_token
|
|
120
127
|
});
|
|
121
128
|
if (error || !data.session) {
|