After some debugging, it seems inside node_modules/@supabase/gotrue-js/dist/module/GoTrueClient.js
we have this code:
async _exchangeCodeForSession(authCode) {
const storageItem = await getItemAsync(this.storage, `${this.storageKey}-code-verifier`);
console.log(`${this.storageKey}-code-verifier`)
console.log({storageItem});
const [codeVerifier, redirectType] = (storageItem !== null && storageItem !== void 0 ? storageItem : '').split('/');
const { data, error } = await _request(this.fetch, 'POST', `${this.url}/token?grant_type=pkce`, {
headers: this.headers,
body: {
auth_code: authCode,
code_verifier: codeVerifier,
},
xform: _sessionResponse,
});
First time when i start the app i get:
storageKey: 'sb-wcrlwtvozfucqjwumnpc-auth-token-code-verifier'
storageItem: null
Second/third etc:
storageKey: 'sb-wcrlwtvozfucqjwumnpc-auth-token-code-verifier'
storageItem: 'e3b9d9ff99232e41d08d4f29a56675f8db1cc82a3csomerandomtoken'
I tried this method in both astro / remix and there it works first time. In Next, it seems it doesn't find that storageItem