Azure Notification Hub: FCM V1 (The Push Notification System rejected the request because of an invalid credential)

Guy Wouters 20 Reputation points
2025-05-12T18:16:34.49+00:00

Hi,

I have setup Azure Notification from scratch and set up FCM V1 using the tutorial https://learn.microsoft.com/en-us/dotnet/maui/data-cloud/push-notifications?view=net-maui-9.0

When all setup I receive the message

The Push Notification System rejected the request because of an invalid credentialThe Push Notification System rejected the request because of an invalid credentialwhen sending a test via the Azure portal.

I've searched extensively on the internet but have not found any solution.

I experience the same error with my home setup as well as at my work.

things I tried:

  • legacy google has never been enabled in ANH
  • only FCM V1 is enabled in Google console (legacy disabled)
  • user in Google console has owner permission
Azure Notification Hubs
Azure Notification Hubs
An Azure service that is used to send push notifications to all major platforms from the cloud or on-premises environments.
{count} votes

Accepted answer
  1. Gaurav Kumar 785 Reputation points Moderator
    2025-06-06T10:21:53.68+00:00

    Hello Guy Wouters,

    The Push Notification System rejected the request because of an invalid credential

    Try the Below Workaround to resolve this issue:

    Confirm Token Handling by Azure Notification Hub

    Azure internally handles OAuth2 token refresh for FCM V1 service accounts.

    FCM V1 tokens expire after 1 hour. Intermittent failures may occur if token refresh fails due to caching or transient network issues.

    For more details, please refer the following documentation: Firebase OAuth 2.0 Tokens,

    ANH Token Refresh Behavior

    Force Reauthentication with Fresh Credentials

    To avoid cached/stale credentials:

    Delete existing FCM V1 credentials in the Azure Portal.

    Regenerate a new service account key in the Firebase Console.

    Re-add the new JSON key into the Azure Notification Hub under FCM V1 Settings.

    Refer: Configure FCM V1 in Azure

    Validate Network Connectivity (Advanced)

    Use tools like Azure Network Watcher, tcping, or similar from your environment to test outbound HTTPS access:

    tcping fcm.googleapis.com 443
    

    Even brief interruptions to fcm.googleapis.com:443 can trigger token refresh or auth issues.

    Enable Logging at Namespace Level

    Azure logs for Notification Hub are only available at the namespace level (NHNS).

    • Navigate to Notification Hub Namespace > Diagnostic settings.
    • Enable logs:OperationalLogs, RuntimeAuditLogs, Send to Log Analytics or Storage Account
    • Use this Kusto query in Log Analytics:
    
    AzureDiagnostics
    
    | where ResourceProvider == "MICROSOFT.NOTIFICATIONHUBS"
    
    | where OperationName == "Microsoft.NotificationHubs/namespaces/notificationHubs/messages/send"
    
    | project TimeGenerated, ResultDescription, CorrelationId
    
    | order by TimeGenerated desc
    
    

    Note: Logs may take 5–10 minutes to appear after enabling diagnostics.

    Refer: Enable NH Diagnostic Logs

    Validate Service Account Configuration in Google Cloud

    • Go to IAM & Admin > Service Accounts.
    • Select your service account used for FCM V1.

    Ensure the service account has the Firebase Admin or Editor role.

    Refer: Managing Service Account Keys

    Verify Direct Communication with FCM

    You can run a test script to simulate sending messages directly to FCM. This helps isolate whether the issue is with Azure or the Firebase configuration.

    Example Bash script (using gcloud CLI):

    
    while true; do
    
      curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    
           -H "Content-Type: application/json" \
    
           -d '{
    
                 "message":{
    
                   "token":"DEVICE_TOKEN",
    
                   "notification":{
    
                     "title":"Test",
    
                     "body":"Direct FCM Test"
    
                   }
    
                 }
    
               }' \
    
           "https://fcm.googleapis.com/v1/projects/YOUR_PROJECT_ID/messages:send"
    
      sleep 300
    
    done
    
    

    If this script also fails intermittently, the issue is likely on the Firebase side.

    You mentioned that your Firebase project works better when not testing via the Azure Portal. This aligns with known limitations of Test Send in the Portal.

    Note: Use a C# client or direct REST API to register devices and send notifications. This provides more visibility and reliability.

    I hope this information helps.

    Kindly consider upvoting the comment if the information provided is helpful. This can assist other community members in resolving similar issues.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.