From 91d89996047b818c07d75604c2a892a7585a99f5 Mon Sep 17 00:00:00 2001 From: Yao Cai <67412196+cy948@users.noreply.github.com> Date: Sat, 21 Sep 2024 14:02:42 +0800 Subject: [PATCH] :bug: fix: `providerAccountId` not exist in provider (#4053) * :bug: fix: fix providerAccountId not exist in casdoor * :bug: fix: providerAccountId not provided --- src/libs/next-auth/sso-providers/auth0.ts | 1 + src/libs/next-auth/sso-providers/authelia.ts | 1 + src/libs/next-auth/sso-providers/authentik.ts | 1 + src/libs/next-auth/sso-providers/azure-ad.ts | 1 + src/libs/next-auth/sso-providers/casdoor.ts | 1 + src/libs/next-auth/sso-providers/cloudflare-zero-trust.ts | 1 + src/libs/next-auth/sso-providers/github.ts | 1 + src/libs/next-auth/sso-providers/zitadel.ts | 1 + 8 files changed, 8 insertions(+) diff --git a/src/libs/next-auth/sso-providers/auth0.ts b/src/libs/next-auth/sso-providers/auth0.ts index 4ca84f32e0f7..b7848000841a 100644 --- a/src/libs/next-auth/sso-providers/auth0.ts +++ b/src/libs/next-auth/sso-providers/auth0.ts @@ -19,6 +19,7 @@ const provider = { profile(profile) { return { email: profile.email, + id: profile.sub, image: profile.picture, name: profile.name, providerAccountId: profile.sub, diff --git a/src/libs/next-auth/sso-providers/authelia.ts b/src/libs/next-auth/sso-providers/authelia.ts index 9ac77a0ef67c..3de69d5e75c1 100644 --- a/src/libs/next-auth/sso-providers/authelia.ts +++ b/src/libs/next-auth/sso-providers/authelia.ts @@ -29,6 +29,7 @@ const provider = { profile(profile) { return { email: profile.email, + id: profile.sub, name: profile.name, providerAccountId: profile.sub, }; diff --git a/src/libs/next-auth/sso-providers/authentik.ts b/src/libs/next-auth/sso-providers/authentik.ts index 3b13902269f0..0f2294e0ac84 100644 --- a/src/libs/next-auth/sso-providers/authentik.ts +++ b/src/libs/next-auth/sso-providers/authentik.ts @@ -23,6 +23,7 @@ const provider = { // image: profile.picture, // name: profile.name, // providerAccountId: profile.user_id, + // id: profile.user_id, // }; // }, }), diff --git a/src/libs/next-auth/sso-providers/azure-ad.ts b/src/libs/next-auth/sso-providers/azure-ad.ts index 9aab77da32fd..16643144ed58 100644 --- a/src/libs/next-auth/sso-providers/azure-ad.ts +++ b/src/libs/next-auth/sso-providers/azure-ad.ts @@ -23,6 +23,7 @@ const provider = { // image: profile.picture, // name: profile.name, // providerAccountId: profile.user_id, + // id: profile.user_id, // }; // }, }), diff --git a/src/libs/next-auth/sso-providers/casdoor.ts b/src/libs/next-auth/sso-providers/casdoor.ts index cff4bbf32daf..f9ed43a0f445 100644 --- a/src/libs/next-auth/sso-providers/casdoor.ts +++ b/src/libs/next-auth/sso-providers/casdoor.ts @@ -25,6 +25,7 @@ function LobeCasdoorProvider(config: OIDCUserConfig): OIDCConfig return { email: profile.email, emailVerified: profile.emailVerified ? new Date() : null, + id: profile.id, image: profile.avatar, name: profile.displayName ?? profile.firstName ?? profile.lastName, providerAccountId: profile.id, diff --git a/src/libs/next-auth/sso-providers/cloudflare-zero-trust.ts b/src/libs/next-auth/sso-providers/cloudflare-zero-trust.ts index bd9ba2f13ae4..0c0c2a558021 100644 --- a/src/libs/next-auth/sso-providers/cloudflare-zero-trust.ts +++ b/src/libs/next-auth/sso-providers/cloudflare-zero-trust.ts @@ -25,6 +25,7 @@ const provider = { profile(profile) { return { email: profile.email, + id: profile.sub, name: profile.name ?? profile.email, providerAccountId: profile.sub, }; diff --git a/src/libs/next-auth/sso-providers/github.ts b/src/libs/next-auth/sso-providers/github.ts index 53514fe3cbd1..8c6c019e4227 100644 --- a/src/libs/next-auth/sso-providers/github.ts +++ b/src/libs/next-auth/sso-providers/github.ts @@ -17,6 +17,7 @@ const provider = { profile: (profile) => { return { email: profile.email, + id: profile.id.toString(), image: profile.avatar_url, name: profile.name, providerAccountId: profile.id.toString(), diff --git a/src/libs/next-auth/sso-providers/zitadel.ts b/src/libs/next-auth/sso-providers/zitadel.ts index 97e29f7771ab..8a2897d6b807 100644 --- a/src/libs/next-auth/sso-providers/zitadel.ts +++ b/src/libs/next-auth/sso-providers/zitadel.ts @@ -19,6 +19,7 @@ const provider = { // image: profile.picture, // name: profile.name, // providerAccountId: profile.user_id, + // id: profile.user_id, // }; // }, }),