Merge branch 'main' into shell-updates

This commit is contained in:
Darren Clarke 2023-06-14 06:02:11 +00:00 committed by GitHub
commit db8a3d1ee0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
132 changed files with 3609 additions and 5150 deletions

View file

@ -60,38 +60,20 @@ const nextAuthOptions = (config: IAppConfig, req: NextApiRequest) => {
return {
secret: nextAuth.secret,
session: {
jwt: true,
strategy: "database",
maxAge: 8 * 60 * 60, // 8 hours
},
jwt: {
secret: nextAuth.secret,
encryption: false,
signingKey: nextAuth.signingKey,
encryptionKey: nextAuth.encryptionKey,
},
providers,
adapter,
callbacks: {
async session(session: any, token: any) {
// make the user id available in the react client
session.user.id = token.userId;
async session({ session, user }: any) {
session.user.id = user.id;
session.user.userRole = user.userRole;
return session;
},
async jwt(token: any, user: any) {
const isSignIn = Boolean(user);
// Add auth_time to token on signin in
if (isSignIn) {
// not sure what this does
// if (!token.aud) token.aud;
token.aud = nextAuth.audience;
token.picture = user.avatar;
token.userId = user.id;
token.role = user.userRole ? `app_${user.userRole}` : "app_anonymous";
}
return token;
},
},
};
};

View file

@ -4,7 +4,7 @@ export default createProxyMiddleware({
target:
process.env.NODE_ENV === "production"
? "http://metamigo-api:3001"
: "http://localhost:3001",
: "http://127.0.0.1:3001",
changeOrigin: true,
pathRewrite: { "^/graphql": "/graphql" },
xfwd: true,
@ -20,8 +20,6 @@ export default createProxyMiddleware({
let token = req.cookies["__Secure-next-auth.session-token"];
if (!token) token = req.cookies["next-auth.session-token"];
// console.log(req.body);
// if (req.body.query) console.log(req.body.query);
if (token) {
proxyReq.setHeader("authorization", `Bearer ${token}`);
proxyReq.removeHeader("cookie");