@@ -183,6 +183,7 @@ private ISingleAccountPublicClientApplication createContextFromPluginCall(Plugin
183183 String keyHash = call .getString ("keyHash" );
184184 String authorityTypeString = call .getString ("authorityType" , AuthorityType .AAD .name ());
185185 String authorityUrl = call .getString ("authorityUrl" );
186+ Boolean brokerRedirectUriRegistered = call .getBoolean ("brokerRedirectUriRegistered" , false );
186187
187188 if (keyHash == null || keyHash .length () == 0 ) {
188189 call .reject ("Invalid key hash specified." );
@@ -199,7 +200,7 @@ private ISingleAccountPublicClientApplication createContextFromPluginCall(Plugin
199200 return null ;
200201 }
201202
202- return this .createContext (clientId , domainHint , tenant , authorityType , authorityUrl , keyHash );
203+ return this .createContext (clientId , domainHint , tenant , authorityType , authorityUrl , keyHash , brokerRedirectUriRegistered );
203204 }
204205
205206 private ISingleAccountPublicClientApplication createContext (
@@ -208,20 +209,23 @@ private ISingleAccountPublicClientApplication createContext(
208209 String tenant ,
209210 AuthorityType authorityType ,
210211 String customAuthorityUrl ,
211- String keyHash
212+ String keyHash ,
213+ Boolean brokerRedirectUriRegistered
212214 ) throws MsalException , InterruptedException , IOException , JSONException {
213215 String tenantId = (tenant != null ? tenant : "common" );
214216 String authorityUrl = customAuthorityUrl != null ? customAuthorityUrl : "https://login.microsoftonline.com/" + tenantId ;
215217 String urlEncodedKeyHash = URLEncoder .encode (keyHash , "UTF-8" );
216218 String redirectUri = "msauth://" + getActivity ().getApplicationContext ().getPackageName () + "/" + urlEncodedKeyHash ;
217219
220+ JSONObject configFile = new JSONObject ();
218221 JSONObject authorityConfig = new JSONObject ();
219222
220223 switch (authorityType ) {
221224 case AAD :
222225 authorityConfig .put ("type" , AuthorityType .AAD .name ());
223226 authorityConfig .put ("authority_url" , authorityUrl );
224227 authorityConfig .put ("audience" , (new JSONObject ()).put ("type" , "AzureADMultipleOrgs" ).put ("tenant_id" , tenantId ));
228+ configFile .put ("broker_redirect_uri_registered" , brokerRedirectUriRegistered );
225229 break ;
226230 case B2C :
227231 authorityConfig .put ("type" , AuthorityType .B2C .name ());
@@ -230,12 +234,10 @@ private ISingleAccountPublicClientApplication createContext(
230234 break ;
231235 }
232236
233- JSONObject configFile = new JSONObject ();
234237 configFile .put ("client_id" , clientId );
235238 configFile .put ("domain_hint" , domainHint );
236239 configFile .put ("authorization_user_agent" , "DEFAULT" );
237240 configFile .put ("redirect_uri" , redirectUri );
238- configFile .put ("broker_redirect_uri_registered" , false );
239241 configFile .put ("account_mode" , "SINGLE" );
240242 configFile .put ("authorities" , (new JSONArray ()).put (authorityConfig ));
241243
0 commit comments