File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,24 @@ export default class PubSubApiClient {
102102 * @returns {Promise<void> } Promise that resolves once the connection is established
103103 */
104104 async connectWithAuth ( accessToken , instanceUrl , organizationId , username ) {
105+ if ( ! instanceUrl || ! instanceUrl . startsWith ( 'https://' ) ) {
106+ throw new Error (
107+ `Invalid Salesforce Instance URL format supplied: ${ instanceUrl } `
108+ ) ;
109+ }
110+ if (
111+ ! organizationId ||
112+ ( organizationId . length !== 15 && organizationId . length !== 18 )
113+ ) {
114+ throw new Error (
115+ `Invalid Salesforce Org ID format supplied: ${ organizationId } `
116+ ) ;
117+ }
118+ if ( ! username || username . indexOf ( '@' ) === - 1 ) {
119+ throw new Error (
120+ `Invalid Salesforce username format supplied: ${ username } `
121+ ) ;
122+ }
105123 return this . #connectToPubSubApi( {
106124 accessToken,
107125 instanceUrl,
You can’t perform that action at this time.
0 commit comments