Merge branch 'main' into shell-updates
This commit is contained in:
commit
db8a3d1ee0
132 changed files with 3609 additions and 5150 deletions
|
|
@ -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;
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue