|
41 | 41 | import androidx.annotation.NonNull; |
42 | 42 | import androidx.fragment.app.Fragment; |
43 | 43 |
|
| 44 | +import com.microsoft.identity.common.internal.msafederation.FederatedSignInProviderName; |
| 45 | +import com.microsoft.identity.common.internal.msafederation.MsaFederationConstants; |
44 | 46 | import com.microsoft.identity.common.internal.msafederation.google.SignInWithGoogleCredential; |
45 | 47 | import com.microsoft.identity.common.internal.msafederation.google.SignInWithGoogleParameters; |
46 | 48 | import com.microsoft.identity.common.internal.msafederation.google.SignInWithGoogleApi; |
|
53 | 55 | import com.microsoft.identity.common.java.opentelemetry.SerializableSpanContext; |
54 | 56 | import com.microsoft.identity.common.java.opentelemetry.SpanExtension; |
55 | 57 | import com.microsoft.identity.common.java.ui.AuthorizationAgent; |
| 58 | +import com.microsoft.identity.common.java.util.CommonURIBuilder; |
56 | 59 |
|
| 60 | +import java.net.URISyntaxException; |
57 | 61 | import java.util.HashMap; |
58 | 62 |
|
59 | 63 | /** |
@@ -274,12 +278,24 @@ public static Intent getAuthorizationActivityIntent(final Context context, |
274 | 278 | final String sourceLibraryVersion, |
275 | 279 | @NonNull final SignInWithGoogleCredential signInWithGoogleCredential |
276 | 280 | ) { |
| 281 | + // add header |
277 | 282 | final HashMap<String, String> requestHeadersWithGoogleAuthCredential = requestHeaders == null? new HashMap<>() : new HashMap<>(requestHeaders); |
278 | 283 | requestHeadersWithGoogleAuthCredential.putAll(signInWithGoogleCredential.asHeaders()); |
| 284 | + |
| 285 | + // add id provider query parameter |
| 286 | + String requestUrlWithIdProvider = null; |
| 287 | + try { |
| 288 | + final CommonURIBuilder uriBuilder = new CommonURIBuilder(requestUrl); |
| 289 | + uriBuilder.addParameterIfAbsent(MsaFederationConstants.MSA_ID_PROVIDER_EXTRA_QUERY_PARAM_KEY, FederatedSignInProviderName.GOOGLE.getIdProviderName()); |
| 290 | + requestUrlWithIdProvider = uriBuilder.build().toString(); |
| 291 | + } catch (URISyntaxException e) { |
| 292 | + throw new RuntimeException(e); |
| 293 | + } |
| 294 | + |
279 | 295 | return getAuthorizationActivityIntent( |
280 | 296 | context, |
281 | 297 | authIntent, |
282 | | - requestUrl, |
| 298 | + requestUrlWithIdProvider, |
283 | 299 | redirectUri, |
284 | 300 | requestHeadersWithGoogleAuthCredential, |
285 | 301 | authorizationAgent, |
|
0 commit comments