Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,15 @@ final class FirebaseMessagingClientImpl implements FirebaseMessagingClient {
.put("NOT_FOUND", "registration-token-not-registered")
.put("PERMISSION_DENIED", "mismatched-credential")
.put("RESOURCE_EXHAUSTED", "message-rate-exceeded")
.put("UNAUTHENTICATED", "invalid-apns-credentials")
.put("UNAUTHENTICATED", "third-party-auth-error")

// FCM v1 new error codes
.put("APNS_AUTH_ERROR", "invalid-apns-credentials")
.put("APNS_AUTH_ERROR", "third-party-auth-error")
.put("INTERNAL", FirebaseMessaging.INTERNAL_ERROR)
.put("INVALID_ARGUMENT", "invalid-argument")
.put("QUOTA_EXCEEDED", "message-rate-exceeded")
.put("SENDER_ID_MISMATCH", "mismatched-credential")
.put("THIRD_PARTY_AUTH_ERROR", "third-party-auth-error")
.put("UNAVAILABLE", "server-unavailable")
.put("UNREGISTERED", "registration-token-not-registered")
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,24 @@ public void testSendErrorWithFcmError() {
}
}

@Test
public void testSendErrorWithThirdPartyError() {
for (int code : HTTP_ERRORS) {
response.setStatusCode(code).setContent(
"{\"error\": {\"status\": \"INVALID_ARGUMENT\", \"message\": \"test error\", "
+ "\"details\":[{\"@type\": \"type.googleapis.com/google.firebase.fcm"
+ ".v1.FcmError\", \"errorCode\": \"THIRD_PARTY_AUTH_ERROR\"}]}}");

try {
client.send(EMPTY_MESSAGE, DRY_RUN_DISABLED);
fail("No error thrown for HTTP error");
} catch (FirebaseMessagingException error) {
checkExceptionFromHttpResponse(error, "third-party-auth-error");
}
checkRequestHeader(interceptor.getLastRequest());
}
}

@Test
public void testSendAll() throws Exception {
final TestResponseInterceptor interceptor = new TestResponseInterceptor();
Expand Down