Skip to content

Commit

Permalink
fix(cognitoauth): forward lambda trigger exception for social sign in (
Browse files Browse the repository at this point in the history
  • Loading branch information
eeatonaws authored Sep 12, 2022
1 parent b8d4bf5 commit 6efcaf9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ public class AuthClient {
*/
private static final long REDIRECT_TIMEOUT_SECONDS = 10;

/**
* Message returned for a bad request.
*/
private static final String BAD_REQUEST_ERROR = "invalid_request";

/**
* Android application context.
*/
Expand Down Expand Up @@ -450,10 +455,17 @@ public void run() {
uri.getQueryParameter(ClientConstants.DOMAIN_QUERY_PARAM_ERROR);

if (errorText != null) {
final String errorDescription = uri.getQueryParameter(ClientConstants.DOMAIN_QUERY_PARAM_ERROR_DESCRIPTION);
final String errorMessage;
if (errorText.equals(BAD_REQUEST_ERROR) && errorDescription != null) {
errorMessage = errorDescription.trim();
} else {
errorMessage = errorText;
}
returnCallback = new Runnable() {
@Override
public void run() {
callback.onFailure(new AuthServiceException(errorText));
callback.onFailure(new AuthServiceException(errorMessage));
}
};
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public abstract class ClientConstants {
public static final String DOMAIN_QUERY_PARAM_CODE_CHALLENGE_METHOD_SHA256 = "S256";
public static final String DOMAIN_QUERY_PARAM_CODE_VERIFIER = "code_verifier";
public static final String DOMAIN_QUERY_PARAM_ERROR = "error";
public static final String DOMAIN_QUERY_PARAM_ERROR_DESCRIPTION = "error_description";
public static final String DOMAIN_QUERY_PARAM_REDIRECT_URI = "redirect_uri";
public static final String DOMAIN_QUERY_PARAM_LOGOUT_URI = "logout_uri";
public static final String DOMAIN_QUERY_PARAM_RESPONSE_TYPE = "response_type";
Expand Down

0 comments on commit 6efcaf9

Please sign in to comment.