Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions apps/sim/lib/auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ export const auth = betterAuth({
const now = new Date()

return {
id: profile.id.toString(),
id: `${profile.id.toString()}-${crypto.randomUUID()}`,
name: profile.name || profile.login,
email: profile.email,
image: profile.avatar_url,
Expand Down Expand Up @@ -962,7 +962,7 @@ export const auth = betterAuth({
const now = new Date()

return {
id: uniqueId,
id: `${uniqueId}-${crypto.randomUUID()}`,
name: 'Wealthbox User',
email: `${uniqueId}@wealthbox.user`,
emailVerified: false,
Expand Down Expand Up @@ -1016,7 +1016,7 @@ export const auth = betterAuth({
const user = data.data

return {
id: user.id.toString(),
id: `${user.id.toString()}-${crypto.randomUUID()}`,
name: user.name,
email: user.email,
emailVerified: user.activated,
Expand Down Expand Up @@ -1108,7 +1108,7 @@ export const auth = betterAuth({
})

return {
id: data.user_id || data.hub_id.toString(),
id: `${data.user_id || data.hub_id.toString()}-${crypto.randomUUID()}`,
name: data.user || 'HubSpot User',
email: data.user || `hubspot-${data.hub_id}@hubspot.com`,
emailVerified: true,
Expand Down Expand Up @@ -1162,7 +1162,7 @@ export const auth = betterAuth({
const data = await response.json()

return {
id: data.user_id || data.sub,
id: `${data.user_id || data.sub}-${crypto.randomUUID()}`,
name: data.name || 'Salesforce User',
email: data.email || `salesforce-${data.user_id}@salesforce.com`,
emailVerified: data.email_verified || true,
Expand Down Expand Up @@ -1221,7 +1221,7 @@ export const auth = betterAuth({
const now = new Date()

return {
id: profile.data.id,
id: `${profile.data.id}-${crypto.randomUUID()}`,
name: profile.data.name || 'X User',
email: `${profile.data.username}@x.com`,
image: profile.data.profile_image_url,
Expand Down Expand Up @@ -1295,7 +1295,7 @@ export const auth = betterAuth({
const now = new Date()

return {
id: profile.account_id,
id: `${profile.account_id}-${crypto.randomUUID()}`,
name: profile.name || profile.display_name || 'Confluence User',
email: profile.email || `${profile.account_id}@atlassian.com`,
image: profile.picture || undefined,
Expand Down Expand Up @@ -1406,7 +1406,7 @@ export const auth = betterAuth({
const now = new Date()

return {
id: profile.account_id,
id: `${profile.account_id}-${crypto.randomUUID()}`,
name: profile.name || profile.display_name || 'Jira User',
email: profile.email || `${profile.account_id}@atlassian.com`,
image: profile.picture || undefined,
Expand Down Expand Up @@ -1456,7 +1456,7 @@ export const auth = betterAuth({
const now = new Date()

return {
id: data.id,
id: `${data.id}-${crypto.randomUUID()}`,
name: data.email ? data.email.split('@')[0] : 'Airtable User',
email: data.email || `${data.id}@airtable.user`,
emailVerified: !!data.email,
Expand Down Expand Up @@ -1505,7 +1505,7 @@ export const auth = betterAuth({
const now = new Date()

return {
id: profile.bot?.owner?.user?.id || profile.id,
id: `${profile.bot?.owner?.user?.id || profile.id}-${crypto.randomUUID()}`,
name: profile.name || profile.bot?.owner?.user?.name || 'Notion User',
email: profile.person?.email || `${profile.id}@notion.user`,
emailVerified: !!profile.person?.email,
Expand Down Expand Up @@ -1572,7 +1572,7 @@ export const auth = betterAuth({
const now = new Date()

return {
id: data.id,
id: `${data.id}-${crypto.randomUUID()}`,
name: data.name || 'Reddit User',
email: `${data.name}@reddit.user`,
image: data.icon_img || undefined,
Expand Down Expand Up @@ -1644,7 +1644,7 @@ export const auth = betterAuth({
const viewer = data.viewer

return {
id: viewer.id,
id: `${viewer.id}-${crypto.randomUUID()}`,
email: viewer.email,
name: viewer.name,
emailVerified: true,
Expand Down Expand Up @@ -1707,7 +1707,7 @@ export const auth = betterAuth({
const data = await response.json()

return {
id: data.account_id,
id: `${data.account_id}-${crypto.randomUUID()}`,
email: data.email,
name: data.name?.display_name || data.email,
emailVerified: data.email_verified || false,
Expand Down Expand Up @@ -1758,7 +1758,7 @@ export const auth = betterAuth({
const now = new Date()

return {
id: profile.gid,
id: `${profile.gid}-${crypto.randomUUID()}`,
name: profile.name || 'Asana User',
email: profile.email || `${profile.gid}@asana.user`,
image: profile.photo?.image_128x128 || undefined,
Expand Down Expand Up @@ -1834,7 +1834,7 @@ export const auth = betterAuth({
logger.info('Slack credential identifier', { teamId, userId, uniqueId, teamName })

return {
id: uniqueId,
id: `${uniqueId}-${crypto.randomUUID()}`,
name: teamName,
email: `${teamId}-${userId}@slack.bot`,
emailVerified: false,
Expand Down Expand Up @@ -1884,7 +1884,7 @@ export const auth = betterAuth({
const uniqueId = `webflow-${userId}`

return {
id: uniqueId,
id: `${uniqueId}-${crypto.randomUUID()}`,
name: data.user_name || 'Webflow User',
email: `${uniqueId.replace(/[^a-zA-Z0-9]/g, '')}@webflow.user`,
emailVerified: false,
Expand Down Expand Up @@ -1931,7 +1931,7 @@ export const auth = betterAuth({
const profile = await response.json()

return {
id: profile.sub,
id: `${profile.sub}-${crypto.randomUUID()}`,
name: profile.name || 'LinkedIn User',
email: profile.email || `${profile.sub}@linkedin.user`,
emailVerified: profile.email_verified || true,
Expand Down Expand Up @@ -1993,7 +1993,7 @@ export const auth = betterAuth({
const profile = await response.json()

return {
id: profile.id,
id: `${profile.id}-${crypto.randomUUID()}`,
name:
`${profile.first_name || ''} ${profile.last_name || ''}`.trim() || 'Zoom User',
email: profile.email || `${profile.id}@zoom.user`,
Expand Down Expand Up @@ -2060,7 +2060,7 @@ export const auth = betterAuth({
const profile = await response.json()

return {
id: profile.id,
id: `${profile.id}-${crypto.randomUUID()}`,
name: profile.display_name || 'Spotify User',
email: profile.email || `${profile.id}@spotify.user`,
emailVerified: true,
Expand Down Expand Up @@ -2108,7 +2108,7 @@ export const auth = betterAuth({
const profile = await response.json()

return {
id: profile.ID?.toString() || profile.id?.toString(),
id: `${profile.ID?.toString() || profile.id?.toString()}-${crypto.randomUUID()}`,
name: profile.display_name || profile.username || 'WordPress User',
email: profile.email || `${profile.username}@wordpress.com`,
emailVerified: profile.email_verified || false,
Expand Down
2 changes: 2 additions & 0 deletions packages/db/migrations/0140_fuzzy_the_twelve.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DROP INDEX "account_user_provider_account_unique";--> statement-breakpoint
CREATE UNIQUE INDEX "account_user_provider_unique" ON "account" USING btree ("user_id","provider_id");
Loading