mirror of
https://github.com/soconnor0919/beenvoice.git
synced 2026-02-05 00:06:36 -05:00
db: push sso changes
This commit is contained in:
@@ -87,8 +87,8 @@ export function SettingsContent() {
|
|||||||
const handleLinkAuthentik = async () => {
|
const handleLinkAuthentik = async () => {
|
||||||
setIsLinking(true);
|
setIsLinking(true);
|
||||||
try {
|
try {
|
||||||
await authClient.linkSocial({
|
await authClient.signIn.sso({
|
||||||
provider: "authentik",
|
domain: "beenvoice.soconnor.dev",
|
||||||
callbackURL: "/dashboard/settings",
|
callbackURL: "/dashboard/settings",
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export const auth = betterAuth({
|
|||||||
session: schema.sessions,
|
session: schema.sessions,
|
||||||
account: schema.accounts,
|
account: schema.accounts,
|
||||||
verification: schema.verificationTokens,
|
verification: schema.verificationTokens,
|
||||||
|
ssoProvider: schema.ssoProviders,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
trustedOrigins: [
|
trustedOrigins: [
|
||||||
@@ -60,6 +61,9 @@ export const auth = betterAuth({
|
|||||||
jwksEndpoint: "https://auth.soconnor.dev/application/o/beenvoice/jwks/",
|
jwksEndpoint: "https://auth.soconnor.dev/application/o/beenvoice/jwks/",
|
||||||
scopes: ["openid", "email", "profile"],
|
scopes: ["openid", "email", "profile"],
|
||||||
pkce: true,
|
pkce: true,
|
||||||
|
mapping: {
|
||||||
|
emailVerified: "email_verified",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -106,6 +106,21 @@ export const verificationTokens = createTable(
|
|||||||
(t) => [index("verification_token_identifier_idx").on(t.identifier)],
|
(t) => [index("verification_token_identifier_idx").on(t.identifier)],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const ssoProviders = createTable(
|
||||||
|
"sso_provider",
|
||||||
|
(d) => ({
|
||||||
|
id: d.varchar({ length: 255 }).notNull().primaryKey().$defaultFn(() => crypto.randomUUID()),
|
||||||
|
providerId: d.varchar({ length: 255 }).notNull().unique(),
|
||||||
|
userId: d.varchar({ length: 255 }).notNull().references(() => users.id),
|
||||||
|
redirectURI: d.varchar({ length: 255 }).notNull().default(""), // Added detailed fields
|
||||||
|
oidcConfig: d.text(),
|
||||||
|
samlConfig: d.text(),
|
||||||
|
createdAt: d.timestamp().notNull().defaultNow(),
|
||||||
|
updatedAt: d.timestamp().notNull().defaultNow().$onUpdate(() => new Date()),
|
||||||
|
}),
|
||||||
|
(t) => [index("sso_provider_user_id_idx").on(t.userId)],
|
||||||
|
);
|
||||||
|
|
||||||
// Invoicing app tables
|
// Invoicing app tables
|
||||||
export const clients = createTable(
|
export const clients = createTable(
|
||||||
"client",
|
"client",
|
||||||
|
|||||||
Reference in New Issue
Block a user