The Token obtained from the Token Provider is wrong

Hemachandhiran Harimoorthy 0 Reputation points
2023-01-18T05:43:02.1766667+00:00

We are implementing Azure Notification Hub for push notification. We developed React application and obtained fcm token.

We are using C# code backend to registration. Below is the registration code

var fcmInstallation = new Installation
            {
                InstallationId = "<GUID>",
                Platform = NotificationPlatform.Fcm,
                PushChannel = "<Token Received From Firebase>",
                PushChannelExpired = false,
                Tags = new[] { "fcm" },
                 
            };
            await nhClient.CreateOrUpdateInstallationAsync(fcmInstallation);

The registration is successful and I'm able to see the registered devices using
var devices = await nhClient.GetAllRegistrationsAsync(5);

When I try to send test notification from Azure Hub I'm getting error message

"The Token obtained from the Token Provider is wrong".

I verified the server key from firebase and Google(GCM/FCM) API key in Notification Hub. Both are matching.

Not sure what is wrong?

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.
153 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 16,241 Reputation points Microsoft Employee
    2023-02-02T02:19:21.54+00:00

    Hi @Hemachandhiran Harimoorthy , apologies for the late reply. The error message The Token obtained from the Token Provider is wrong indicates the configured credentials for your Notification Hub is invalid. Looking at your code snippet, the configured PushChannel may not be correct. It should be set to what's returned from PNS/FireBase.

    No comments