Skip to content

Commit 3c68229

Browse files
committed
add id provider query param
1 parent 0f373fe commit 3c68229

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

common/src/main/java/com/microsoft/identity/common/internal/providers/oauth2/AuthorizationActivityFactory.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
import androidx.annotation.NonNull;
4242
import androidx.fragment.app.Fragment;
4343

44+
import com.microsoft.identity.common.internal.msafederation.FederatedSignInProviderName;
45+
import com.microsoft.identity.common.internal.msafederation.MsaFederationConstants;
4446
import com.microsoft.identity.common.internal.msafederation.google.SignInWithGoogleCredential;
4547
import com.microsoft.identity.common.internal.msafederation.google.SignInWithGoogleParameters;
4648
import com.microsoft.identity.common.internal.msafederation.google.SignInWithGoogleApi;
@@ -53,7 +55,9 @@
5355
import com.microsoft.identity.common.java.opentelemetry.SerializableSpanContext;
5456
import com.microsoft.identity.common.java.opentelemetry.SpanExtension;
5557
import com.microsoft.identity.common.java.ui.AuthorizationAgent;
58+
import com.microsoft.identity.common.java.util.CommonURIBuilder;
5659

60+
import java.net.URISyntaxException;
5761
import java.util.HashMap;
5862

5963
/**
@@ -274,12 +278,24 @@ public static Intent getAuthorizationActivityIntent(final Context context,
274278
final String sourceLibraryVersion,
275279
@NonNull final SignInWithGoogleCredential signInWithGoogleCredential
276280
) {
281+
// add header
277282
final HashMap<String, String> requestHeadersWithGoogleAuthCredential = requestHeaders == null? new HashMap<>() : new HashMap<>(requestHeaders);
278283
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+
279295
return getAuthorizationActivityIntent(
280296
context,
281297
authIntent,
282-
requestUrl,
298+
requestUrlWithIdProvider,
283299
redirectUri,
284300
requestHeadersWithGoogleAuthCredential,
285301
authorizationAgent,

0 commit comments

Comments
 (0)