Skip to content

Commit 2737bb8

Browse files
author
aadamgough
committed
removed unnecessary file and reverted oauth.ts
1 parent 8de7611 commit 2737bb8

File tree

2 files changed

+195
-32
lines changed

2 files changed

+195
-32
lines changed

apps/sim/lib/oauth/oauth.ts

Lines changed: 195 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
AsanaIcon,
55
ConfluenceIcon,
66
// DiscordIcon,
7+
DropboxIcon,
78
GithubIcon,
89
GmailIcon,
910
GoogleCalendarIcon,
@@ -15,6 +16,7 @@ import {
1516
HubspotIcon,
1617
JiraIcon,
1718
LinearIcon,
19+
LinkedInIcon,
1820
MicrosoftExcelIcon,
1921
MicrosoftIcon,
2022
MicrosoftOneDriveIcon,
@@ -26,13 +28,17 @@ import {
2628
PipedriveIcon,
2729
RedditIcon,
2830
SalesforceIcon,
31+
ShopifyIcon,
2932
SlackIcon,
33+
// SupabaseIcon,
3034
TrelloIcon,
3135
WealthboxIcon,
3236
WebflowIcon,
37+
WordpressIcon,
3338
xIcon,
39+
ZoomIcon,
3440
} from '@/components/icons'
35-
import { env } from '@/lib/env'
41+
import { env } from '@/lib/core/config/env'
3642
import { createLogger } from '@/lib/logs/console/logger'
3743

3844
const logger = createLogger('OAuth')
@@ -47,6 +53,7 @@ export type OAuthProvider =
4753
| 'notion'
4854
| 'jira'
4955
// | 'discord'
56+
| 'dropbox'
5057
| 'microsoft'
5158
| 'linear'
5259
| 'slack'
@@ -58,6 +65,10 @@ export type OAuthProvider =
5865
| 'pipedrive'
5966
| 'hubspot'
6067
| 'salesforce'
68+
| 'linkedin'
69+
| 'shopify'
70+
| 'zoom'
71+
| 'wordpress'
6172
| string
6273

6374
export type OAuthService =
@@ -77,6 +88,7 @@ export type OAuthService =
7788
| 'notion'
7889
| 'jira'
7990
// | 'discord'
91+
| 'dropbox'
8092
| 'microsoft-excel'
8193
| 'microsoft-teams'
8294
| 'microsoft-planner'
@@ -93,7 +105,10 @@ export type OAuthService =
93105
| 'pipedrive'
94106
| 'hubspot'
95107
| 'salesforce'
96-
108+
| 'linkedin'
109+
| 'shopify'
110+
| 'zoom'
111+
| 'wordpress'
97112
export interface OAuthProviderConfig {
98113
id: OAuthProvider
99114
name: string
@@ -535,6 +550,55 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
535550
},
536551
defaultService: 'linear',
537552
},
553+
dropbox: {
554+
id: 'dropbox',
555+
name: 'Dropbox',
556+
icon: (props) => DropboxIcon(props),
557+
services: {
558+
dropbox: {
559+
id: 'dropbox',
560+
name: 'Dropbox',
561+
description: 'Upload, download, share, and manage files in Dropbox.',
562+
providerId: 'dropbox',
563+
icon: (props) => DropboxIcon(props),
564+
baseProviderIcon: (props) => DropboxIcon(props),
565+
scopes: [
566+
'account_info.read',
567+
'files.metadata.read',
568+
'files.metadata.write',
569+
'files.content.read',
570+
'files.content.write',
571+
'sharing.read',
572+
'sharing.write',
573+
],
574+
},
575+
},
576+
defaultService: 'dropbox',
577+
},
578+
shopify: {
579+
id: 'shopify',
580+
name: 'Shopify',
581+
icon: (props) => ShopifyIcon(props),
582+
services: {
583+
shopify: {
584+
id: 'shopify',
585+
name: 'Shopify',
586+
description: 'Manage products, orders, and customers in your Shopify store.',
587+
providerId: 'shopify',
588+
icon: (props) => ShopifyIcon(props),
589+
baseProviderIcon: (props) => ShopifyIcon(props),
590+
scopes: [
591+
'write_products',
592+
'write_orders',
593+
'write_customers',
594+
'write_inventory',
595+
'read_locations',
596+
'write_merchant_managed_fulfillment_orders',
597+
],
598+
},
599+
},
600+
defaultService: 'shopify',
601+
},
538602
slack: {
539603
id: 'slack',
540604
name: 'Slack',
@@ -732,6 +796,23 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
732796
},
733797
defaultService: 'hubspot',
734798
},
799+
linkedin: {
800+
id: 'linkedin',
801+
name: 'LinkedIn',
802+
icon: (props) => LinkedInIcon(props),
803+
services: {
804+
linkedin: {
805+
id: 'linkedin',
806+
name: 'LinkedIn',
807+
description: 'Share posts and access profile data on LinkedIn.',
808+
providerId: 'linkedin',
809+
icon: (props) => LinkedInIcon(props),
810+
baseProviderIcon: (props) => LinkedInIcon(props),
811+
scopes: ['profile', 'openid', 'email', 'w_member_social'],
812+
},
813+
},
814+
defaultService: 'linkedin',
815+
},
735816
salesforce: {
736817
id: 'salesforce',
737818
name: 'Salesforce',
@@ -749,6 +830,52 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
749830
},
750831
defaultService: 'salesforce',
751832
},
833+
zoom: {
834+
id: 'zoom',
835+
name: 'Zoom',
836+
icon: (props) => ZoomIcon(props),
837+
services: {
838+
zoom: {
839+
id: 'zoom',
840+
name: 'Zoom',
841+
description: 'Create and manage Zoom meetings, users, and recordings.',
842+
providerId: 'zoom',
843+
icon: (props) => ZoomIcon(props),
844+
baseProviderIcon: (props) => ZoomIcon(props),
845+
scopes: [
846+
'user:read:user',
847+
'meeting:write:meeting',
848+
'meeting:read:meeting',
849+
'meeting:read:list_meetings',
850+
'meeting:update:meeting',
851+
'meeting:delete:meeting',
852+
'meeting:read:invitation',
853+
'meeting:read:list_past_participants',
854+
'cloud_recording:read:list_user_recordings',
855+
'cloud_recording:read:list_recording_files',
856+
'cloud_recording:delete:recording_file',
857+
],
858+
},
859+
},
860+
defaultService: 'zoom',
861+
},
862+
wordpress: {
863+
id: 'wordpress',
864+
name: 'WordPress',
865+
icon: (props) => WordpressIcon(props),
866+
services: {
867+
wordpress: {
868+
id: 'wordpress',
869+
name: 'WordPress',
870+
description: 'Manage posts, pages, media, comments, and more on WordPress sites.',
871+
providerId: 'wordpress',
872+
icon: (props) => WordpressIcon(props),
873+
baseProviderIcon: (props) => WordpressIcon(props),
874+
scopes: ['global'],
875+
},
876+
},
877+
defaultService: 'wordpress',
878+
},
752879
}
753880

754881
export function getServiceByProviderAndId(
@@ -1129,6 +1256,18 @@ function getProviderAuthConfig(provider: string): ProviderAuthConfig {
11291256
useBasicAuth: true,
11301257
}
11311258
}
1259+
case 'dropbox': {
1260+
const { clientId, clientSecret } = getCredentials(
1261+
env.DROPBOX_CLIENT_ID,
1262+
env.DROPBOX_CLIENT_SECRET
1263+
)
1264+
return {
1265+
tokenEndpoint: 'https://api.dropboxapi.com/oauth2/token',
1266+
clientId,
1267+
clientSecret,
1268+
useBasicAuth: false,
1269+
}
1270+
}
11321271
case 'slack': {
11331272
const { clientId, clientSecret } = getCredentials(
11341273
env.SLACK_CLIENT_ID,
@@ -1219,6 +1358,19 @@ function getProviderAuthConfig(provider: string): ProviderAuthConfig {
12191358
supportsRefreshTokenRotation: true,
12201359
}
12211360
}
1361+
case 'linkedin': {
1362+
const { clientId, clientSecret } = getCredentials(
1363+
env.LINKEDIN_CLIENT_ID,
1364+
env.LINKEDIN_CLIENT_SECRET
1365+
)
1366+
return {
1367+
tokenEndpoint: 'https://www.linkedin.com/oauth/v2/accessToken',
1368+
clientId,
1369+
clientSecret,
1370+
useBasicAuth: false,
1371+
supportsRefreshTokenRotation: false,
1372+
}
1373+
}
12221374
case 'salesforce': {
12231375
const { clientId, clientSecret } = getCredentials(
12241376
env.SALESFORCE_CLIENT_ID,
@@ -1232,6 +1384,46 @@ function getProviderAuthConfig(provider: string): ProviderAuthConfig {
12321384
supportsRefreshTokenRotation: false,
12331385
}
12341386
}
1387+
case 'shopify': {
1388+
// Shopify access tokens don't expire and don't support refresh tokens
1389+
// This configuration is provided for completeness but won't be used for token refresh
1390+
const { clientId, clientSecret } = getCredentials(
1391+
env.SHOPIFY_CLIENT_ID,
1392+
env.SHOPIFY_CLIENT_SECRET
1393+
)
1394+
return {
1395+
tokenEndpoint: 'https://accounts.shopify.com/oauth/token',
1396+
clientId,
1397+
clientSecret,
1398+
useBasicAuth: false,
1399+
supportsRefreshTokenRotation: false,
1400+
}
1401+
}
1402+
case 'zoom': {
1403+
const { clientId, clientSecret } = getCredentials(env.ZOOM_CLIENT_ID, env.ZOOM_CLIENT_SECRET)
1404+
return {
1405+
tokenEndpoint: 'https://zoom.us/oauth/token',
1406+
clientId,
1407+
clientSecret,
1408+
useBasicAuth: true,
1409+
supportsRefreshTokenRotation: false,
1410+
}
1411+
}
1412+
case 'wordpress': {
1413+
// WordPress.com does NOT support refresh tokens
1414+
// Users will need to re-authorize when tokens expire (~2 weeks)
1415+
const { clientId, clientSecret } = getCredentials(
1416+
env.WORDPRESS_CLIENT_ID,
1417+
env.WORDPRESS_CLIENT_SECRET
1418+
)
1419+
return {
1420+
tokenEndpoint: 'https://public-api.wordpress.com/oauth2/token',
1421+
clientId,
1422+
clientSecret,
1423+
useBasicAuth: false,
1424+
supportsRefreshTokenRotation: false,
1425+
}
1426+
}
12351427
default:
12361428
throw new Error(`Unsupported provider: ${provider}`)
12371429
}
@@ -1282,6 +1474,7 @@ export async function refreshOAuthToken(
12821474
// Get the provider from the providerId (e.g., 'google-drive' -> 'google')
12831475
const provider = providerId.split('-')[0]
12841476

1477+
// Get provider configuration
12851478
const config = getProviderAuthConfig(provider)
12861479

12871480
// Build authentication request

apps/sim/lib/oauth/pkce.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)