File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
apps/sim/app/api/auth/oauth/token Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ export const dynamic = 'force-dynamic'
1010
1111const logger = createLogger ( 'OAuthTokenAPI' )
1212
13+ const SALESFORCE_INSTANCE_URL_REGEX = / _ _ s f _ i n s t a n c e _ _ : ( [ ^ \s ] + ) /
14+
1315const tokenRequestSchema = z . object ( {
1416 credentialId : z
1517 . string ( { required_error : 'Credential ID is required' } )
@@ -81,7 +83,7 @@ export async function POST(request: NextRequest) {
8183
8284 let instanceUrl : string | undefined
8385 if ( credential . providerId === 'salesforce' && credential . scope ) {
84- const instanceMatch = credential . scope . match ( / _ _ s f _ i n s t a n c e _ _ : ( [ ^ \s ] + ) / )
86+ const instanceMatch = credential . scope . match ( SALESFORCE_INSTANCE_URL_REGEX )
8587 if ( instanceMatch ) {
8688 instanceUrl = instanceMatch [ 1 ]
8789 }
@@ -161,7 +163,7 @@ export async function GET(request: NextRequest) {
161163 // For Salesforce, extract instanceUrl from the scope field
162164 let instanceUrl : string | undefined
163165 if ( credential . providerId === 'salesforce' && credential . scope ) {
164- const instanceMatch = credential . scope . match ( / _ _ s f _ i n s t a n c e _ _ : ( [ ^ \s ] + ) / )
166+ const instanceMatch = credential . scope . match ( SALESFORCE_INSTANCE_URL_REGEX )
165167 if ( instanceMatch ) {
166168 instanceUrl = instanceMatch [ 1 ]
167169 }
You can’t perform that action at this time.
0 commit comments