D
Deno

help

Unable to make local session persistence with Firebase Auth on Deno Fresh

P.poncho.9/27/2022
Hello I'm running a basic app for testing firebase auth. My implementation is as follows: - The firebase app is initialized in ~/back/firebase.ts using env variables for the configuration values. - The sign-in functionality is in ~/routes/api/signin, The POST method executes the signin using firebase auth and redirects to /profile. The GET method returns the current session for fetching. - The /profile page redirects to /signin if there is no user in sessión, and would otherwise display the user's data. - The polyfills recommended by the documentation (https://deno.com/deploy/docs/tutorial-firebase) are inside ~/main.ts. When I run the app, and sign-in, the session is not stored locally. I've tried using the solution in the tutorial I mentioned earlier, but honestly it is unclear to me how to adapt the localStorage middleware to fresh correctly. Something different I tried to solve this was using Firebase Auth's function setPersistence(auth, browserLocalPersistence); but it never had any effect on the client. Thanks in advance.

Looking for more? Join the community!