Skip to content

Instantly share code, notes, and snippets.

@vpaladino778
Created December 17, 2021 14:15
Show Gist options
  • Save vpaladino778/92dbe6191f31d237baf0249794ddeec9 to your computer and use it in GitHub Desktop.
Save vpaladino778/92dbe6191f31d237baf0249794ddeec9 to your computer and use it in GitHub Desktop.
api/login.ts
import { NextApiRequest, NextApiResponse } from 'next';
import { setAuthCookies } from 'next-firebase-auth';
import initAuth from '../../service/auth/initAuth';
initAuth();
const handler = async (req: NextApiRequest, res: NextApiResponse<any>) => {
try {
await setAuthCookies(req, res);
} catch (e) {
return res.status(500).json({ error: 'Unexpected error.' });
}
return res.status(200).json({ success: true });
};
export default handler;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment