Skip to content

Commit d7e669a

Browse files
tjleingThomas Leing
andauthored
Correctly pass Pinpoint ID (or null if it's not there) to Cognito User Pool (#3060)
Co-authored-by: Thomas Leing <[email protected]>
1 parent 8f159c4 commit d7e669a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

aws-android-sdk-mobile-client/src/main/java/com/amazonaws/mobile/client/AWSMobileClient.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,9 @@ public void onUserSignedOut() {
587587
mUserPoolPoolId = userPoolJSON.getString("PoolId");
588588
final String clientId = userPoolJSON.getString("AppClientId");
589589
final String clientSecret = userPoolJSON.optString("AppClientSecret");
590-
final String pinpointEndpointId = CognitoPinpointSharedContext.getPinpointEndpoint(context, userPoolJSON.optString("PinpointAppId"));
590+
// only attach user pool to Pinpoint if customer specifies an app ID
591+
String pinpointAppId = userPoolJSON.optString("PinpointAppId");
592+
pinpointAppId = pinpointAppId.equals("") ? null : pinpointAppId;
591593
final String cognitoUserPoolCustomEndpoint = userPoolJSON.optString(COGNITO_USERPOOL_CUSTOM_ENDPOINT);
592594

593595
final ClientConfiguration clientConfig = new ClientConfiguration();
@@ -601,7 +603,7 @@ public void onUserSignedOut() {
601603

602604
userpoolsLoginKey = String.format("cognito-idp.%s.amazonaws.com/%s", userPoolJSON.getString("Region"), userPoolJSON.getString("PoolId"));
603605

604-
userpool = new CognitoUserPool(mContext, mUserPoolPoolId, clientId, clientSecret, userpoolLL, pinpointEndpointId, cognitoUserPoolCustomEndpoint);
606+
userpool = new CognitoUserPool(mContext, mUserPoolPoolId, clientId, clientSecret, userpoolLL, pinpointAppId, cognitoUserPoolCustomEndpoint);
605607
userpool.setPersistenceEnabled(mIsPersistenceEnabled);
606608

607609
mDeviceOperations = new DeviceOperations(AWSMobileClient.this, userpoolLL);

0 commit comments

Comments
 (0)