mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-30 22:49:03 +02:00
⚡️ Add support for custom claim paths (#1197)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
1d138cb2ab
commit
104d214d2e
7 changed files with 90 additions and 17 deletions
|
@ -7,7 +7,7 @@ import {
|
|||
NextApiRequest,
|
||||
NextApiResponse,
|
||||
} from "next";
|
||||
import { NextAuthOptions } from "next-auth";
|
||||
import { NextAuthOptions, User } from "next-auth";
|
||||
import NextAuth, {
|
||||
getServerSession as getServerSessionWithOptions,
|
||||
} from "next-auth/next";
|
||||
|
@ -18,10 +18,12 @@ import GoogleProvider from "next-auth/providers/google";
|
|||
import { Provider } from "next-auth/providers/index";
|
||||
|
||||
import { posthog } from "@/app/posthog";
|
||||
import { env } from "@/env";
|
||||
import { absoluteUrl } from "@/utils/absolute-url";
|
||||
import { CustomPrismaAdapter } from "@/utils/auth/custom-prisma-adapter";
|
||||
import { mergeGuestsIntoUser } from "@/utils/auth/merge-user";
|
||||
import { emailClient } from "@/utils/emails";
|
||||
import { getValueByPath } from "@/utils/get-value-by-path";
|
||||
|
||||
const providers: Provider[] = [
|
||||
// When a user registers, we don't want to go through the email verification process
|
||||
|
@ -128,9 +130,10 @@ if (
|
|||
profile(profile) {
|
||||
return {
|
||||
id: profile.sub,
|
||||
name: profile.name,
|
||||
email: profile.email,
|
||||
};
|
||||
name: getValueByPath(profile, env.OIDC_NAME_CLAIM_PATH),
|
||||
email: getValueByPath(profile, env.OIDC_EMAIL_CLAIM_PATH),
|
||||
image: getValueByPath(profile, env.OIDC_PICTURE_CLAIM_PATH),
|
||||
} as User;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue