supabase / auth-js

An isomorphic Javascript library for Supabase Auth.
MIT License
321 stars 152 forks source link

feat: base64-encode session value #816

Closed jebibot closed 6 months ago

jebibot commented 7 months ago

What kind of change does this PR introduce?

Feature

What is the current behavior?

The session cookie value is a plain JSON string, which gets encoded in ASCII-only storages, such as cookie store. Especially, this causes a mismatch in the length calculation in the cookie chunker in @supabase/ssr; sometimes, cookie values exceed the max length.

What is the new behavior?

This PR base64-encodes the session value before saving in the storage.

The rationale for using base64:

Additional context

hf commented 6 months ago

I would prefer this be fixed in SSR instead of in this library.

jebibot commented 6 months ago

Opened https://github.com/supabase/auth-helpers/pull/701.