fixed 'added 'refreshToken', converted to 'httpOnly', added SSL

fixed 'gql-types' generator
This commit is contained in:
lnn0q 2025-04-06 19:57:14 +03:00
parent d179b8c7c8
commit c190d368de
20 changed files with 314 additions and 179 deletions

View file

@ -7,7 +7,7 @@ import jwt from 'jsonwebtoken';
export async function LoginResolver(
_: any,
{ input }: MutationLoginArgs,
{ identity }: IdentityContext
{ req, res, identity }: IdentityContext
): Promise<Session> {
const error = 'Invalid password or email';
@ -36,14 +36,21 @@ export async function LoginResolver(
data: { refreshToken }
});
res.cookie('jwt', refreshToken, {
httpOnly: true,
sameSite: 'none',
secure: true,
maxAge: 24 * 60 * 60 * 1000
});
return {
accessToken,
refreshToken: {
token: refreshToken,
httpOnly: true,
secure: true,
maxAge: 24 * 60 * 60 * 1000,
sameSite: 'None'
}
accessToken
// refreshToken: {
// token: refreshToken,
// httpOnly: true,
// secure: true,
// maxAge: 24 * 60 * 60 * 1000,
// sameSite: 'None'
// }
};
}