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.
The Token obtained from the Token Provider is wrong
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?
1 answer
Sort by: Most helpful
-
Ryan Hill 29,671 Reputation points Microsoft Employee
2023-02-02T02:19:21.54+00:00