service worker
Unanswered
Transvaal lion posted this in #help-forum
Original message was deleted.
1 Reply
Transvaal lion
const csrf = await axios.get('https://example.com/api/auth/csrf', {withCredentials: false}).catch(e => console.log(e));
const csrfToken = csrf.data.csrfToken;
// const csrfCookie = csrf.headers['set-cookie'][0].split(';')[0].split('=')[1];
const login = await axios.post('https://example.com/api/auth/callback/credentials?', `json=true&csrfToken=${csrfToken}&email=${email}&password=${password}`, {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Cookie: `next-auth.csrf-token=${csrfToken}`
}
}).catch(e => console.log(e));
console.log(login.headers)
const session = await axios.get('https://example.com/api/auth/session');
I tried using this code, it's indeed a 200 response on login, but I don't have any cookies including the session, only a url containing this
"url": "https://example.com/api/auth/signin?csrf=true"