Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions client/src/contexts/AuthContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
import { NavigateFunction } from "react-router-dom";

import { auth } from "../utils/auth/firebase";
import { cookieKeys, setCookie } from "../utils/auth/cookie";
import { useBackendContext } from "./hooks/useBackendContext";

interface AuthContextProps {
Expand Down Expand Up @@ -96,6 +97,10 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {


if (!result?.user) return;

const idToken = await result.user.getIdToken();
setCookie({ key: cookieKeys.ACCESS_TOKEN, value: idToken });

let response = await backend.get(`/users/firebase/${result.user.uid}`);

if (response.data.length === 0) {
Expand Down