@@ -106,13 +106,24 @@ @implementation MSIDWebviewFactory
106
106
return session;
107
107
}
108
108
109
+ #if MSAL_JS_AUTOMATION
109
110
MSIDOAuth2EmbeddedWebviewController *embeddedWebviewController
110
111
= [[MSIDOAuth2EmbeddedWebviewController alloc ] initWithStartURL: configuration.startURL
111
112
endURL: [NSURL URLWithString: configuration.endRedirectUrl]
112
113
webview: webview
113
114
customHeaders: configuration.customHeaders
114
115
platfromParams: nil
116
+ javascript: configuration.javascript
115
117
context: context];
118
+ #else
119
+ MSIDOAuth2EmbeddedWebviewController *embeddedWebviewController
120
+ = [[MSIDOAuth2EmbeddedWebviewController alloc ] initWithStartURL: configuration.startURL
121
+ endURL: [NSURL URLWithString: configuration.endRedirectUrl]
122
+ webview: webview
123
+ customHeaders: configuration.customHeaders
124
+ platfromParams: nil
125
+ context: context];
126
+ #endif
116
127
117
128
#if TARGET_OS_IPHONE
118
129
embeddedWebviewController.parentController = configuration.parentController ;
@@ -183,6 +194,14 @@ @implementation MSIDWebviewFactory
183
194
[result addEntriesFromDictionary: allAuthorizeRequestExtraParameters];
184
195
}
185
196
197
+ #if MSAL_JS_AUTOMATION
198
+ // Remove "script" entry from the additional parameters
199
+ if ([result objectForKey: @" script" ])
200
+ {
201
+ [result removeObjectForKey: @" script" ];
202
+ }
203
+ #endif
204
+
186
205
// PKCE
187
206
if (pkce)
188
207
{
@@ -261,6 +280,9 @@ - (MSIDAuthorizeWebRequestConfiguration *)authorizeWebRequestConfigurationWithRe
261
280
262
281
NSString *oauthState = [self generateStateValue ];
263
282
NSDictionary *authorizeQuery = [self authorizationParametersFromRequestParameters: parameters pkce: pkce requestState: oauthState];
283
+ #if MSAL_JS_AUTOMATION
284
+ NSString *javascript = [[parameters allAuthorizeRequestExtraParametersWithMetadata: YES ] objectForKey: @" script" ];
285
+ #endif
264
286
NSURL *startURL = [self startURLWithEndpoint: authorizeEndpoint authority: parameters.authority query: authorizeQuery context: parameters];
265
287
NSString *endRedirectUri = parameters.redirectUri ;
266
288
@@ -270,12 +292,23 @@ - (MSIDAuthorizeWebRequestConfiguration *)authorizeWebRequestConfigurationWithRe
270
292
endRedirectUri = parameters.nestedAuthBrokerRedirectUri ;
271
293
}
272
294
295
+ #if MSAL_JS_AUTOMATION
296
+ MSIDAuthorizeWebRequestConfiguration *configuration = [[MSIDAuthorizeWebRequestConfiguration alloc ] initWithStartURL: startURL
297
+ endRedirectUri: endRedirectUri
298
+ pkce: pkce
299
+ state: oauthState
300
+ ignoreInvalidState: NO
301
+ javascript: javascript
302
+ ssoContext: parameters.ssoContext];
303
+ #else
273
304
MSIDAuthorizeWebRequestConfiguration *configuration = [[MSIDAuthorizeWebRequestConfiguration alloc ] initWithStartURL: startURL
274
305
endRedirectUri: endRedirectUri
275
306
pkce: pkce
276
307
state: oauthState
277
308
ignoreInvalidState: NO
278
309
ssoContext: parameters.ssoContext];
310
+ #endif
311
+
279
312
configuration.customHeaders = parameters.customWebviewHeaders ;
280
313
configuration.parentController = parameters.parentViewController ;
281
314
configuration.prefersEphemeralWebBrowserSession = parameters.prefersEphemeralWebBrowserSession ;
0 commit comments