Error from middleware:
✓ Compiled middleware in 2ms
✓ Compiled in 68ms
Returning false from isAuthenticated because Error: {"code":"NoAuthProvider","message":"No auth provider found matching the given token"}
at async isAuthenticated (../../../src/nextjs/server/index.tsx:321:11)
at async (middleware.ts:11:12)
at async (../../../src/nextjs/server/index.tsx:239:8)
9 | export default convexAuthNextjsMiddleware(async (request, { convexAuth }) => {
10 | if (isSignInPage(request)) {
> 11 | if (await convexAuth.isAuthenticated()) {
| ^
12 | return nextjsMiddlewareRedirect(request, "/");
13 | }
14 | } else { {
}
The auth.config.ts:
export default {
providers: [
{
domain: process.env.CONVEX_SITE_URL,
applicationID: "convex",
},
],
};
The auth.ts:
import { convexAuth } from "@convex-dev/auth/server";
import Authentik from '@auth/core/providers/authentik';
export const { auth, signIn, signOut, store, isAuthenticated } = convexAuth({
providers: [
Authentik({
clientId: process.env.AUTH_AUTHENTIK_CLIENT_ID,
clientSecret: process.env.AUTH_AUTHENTIK_CLIENT_SECRET,
issuer: process.env.AUTH_AUTHENTIK_ISSUER,
profile(profile) {
return {
id: profile.sub,
name: profile.name,
email: profile.email,
groups: profile.groups
}
}
}),
],
callbacks: {
async createOrUpdateUser(
ctx,
{ existingUserId, profile, provider, type, shouldLink },
) {
...
},
}
});