widget email 8
This commit is contained in:
parent
57bc16072f
commit
6ecdda9b82
@ -59,6 +59,10 @@ export const authOptions: NextAuthOptions = {
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
session: {
|
||||||
|
strategy: "jwt",
|
||||||
|
maxAge: 30 * 24 * 60 * 60, // 30 days
|
||||||
|
},
|
||||||
callbacks: {
|
callbacks: {
|
||||||
async jwt({ token, account, profile }) {
|
async jwt({ token, account, profile }) {
|
||||||
// Log only non-sensitive information
|
// Log only non-sensitive information
|
||||||
@ -128,7 +132,6 @@ export const authOptions: NextAuthOptions = {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async session({ session, token }) {
|
async session({ session, token }) {
|
||||||
console.log("Session callback - processing session for user:", token.sub);
|
console.log("Session callback - processing session for user:", token.sub);
|
||||||
|
|
||||||
@ -153,7 +156,7 @@ export const authOptions: NextAuthOptions = {
|
|||||||
session.rocketChatUserId = token.rocketChatUserId || null;
|
session.rocketChatUserId = token.rocketChatUserId || null;
|
||||||
|
|
||||||
return session;
|
return session;
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
async signOut({ token }) {
|
async signOut({ token }) {
|
||||||
@ -180,7 +183,11 @@ export const authOptions: NextAuthOptions = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
debug: process.env.NODE_ENV === 'development', // Only enable debug logging in development
|
pages: {
|
||||||
|
signIn: '/signin',
|
||||||
|
error: '/signin',
|
||||||
|
},
|
||||||
|
debug: process.env.NODE_ENV === 'development',
|
||||||
};
|
};
|
||||||
|
|
||||||
const handler = NextAuth(authOptions);
|
const handler = NextAuth(authOptions);
|
||||||
|
|||||||
@ -23,7 +23,7 @@ export async function GET(req: NextRequest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// First, get a Nextcloud OIDC token using client credentials
|
// First, get a Nextcloud OIDC token using client credentials
|
||||||
const tokenResponse = await fetch(`${nextcloudUrl}/index.php/apps/oauth2/api/v1/token`, {
|
const tokenResponse = await fetch(`${nextcloudUrl}/apps/oauth2/api/v1/token`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
@ -36,9 +36,11 @@ export async function GET(req: NextRequest) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!tokenResponse.ok) {
|
if (!tokenResponse.ok) {
|
||||||
|
const errorData = await tokenResponse.json();
|
||||||
console.error('Failed to get Nextcloud token:', {
|
console.error('Failed to get Nextcloud token:', {
|
||||||
status: tokenResponse.status,
|
status: tokenResponse.status,
|
||||||
statusText: tokenResponse.statusText,
|
statusText: tokenResponse.statusText,
|
||||||
|
error: errorData
|
||||||
});
|
});
|
||||||
return NextResponse.json({ error: 'Nextcloud authentication failed' }, { status: 401 });
|
return NextResponse.json({ error: 'Nextcloud authentication failed' }, { status: 401 });
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user