locked
Error "The token obtained from the Token Provider is wrong" when trying to send push notification to the GCM clients via "Test Send" section in Azure Portal RRS feed

  • Question

  • Hi all,

    I'm upgrading a Xamarin.Android app from GCM to FCM push notification system based on https://docs.microsoft.com/en-in/azure/notification-hubs/xamarin-notification-hubs-push-notifications-android-gcm tutorial.

    The upgraded app works fine and receives push notifications correctly. But during regression we faced with a problem on the OLD clients that they stopped receiving any notifications.

    When I send any message via "Test Send" section with a "Custom Template" platform to a registered device with an OLD GCM token it shows me an error "The Token obtained from the Token Provider is wrong".

    I removed all the registrations for this particular hub, I cleared all the data for the app on a device. So the registration is fresh.

    I tried this OLD token to send direct message from Firebase Cloud Messaging Interface and it's delivered to the device correctly.

    I tried to setup "Google GCM" API key with both "Server Key" and "Legacy Server Key". Each time when I update API key configuration I remove all registrations for the hub and clear app data on a device.

    All those manipulations didn't help. New upgraded clients receives messages correctly, but for OLD clients I still receive an error "The Token obtained from the Token Provider is wrong".

    Could someone help me figure out what is going on?

    Regards



    Thursday, August 16, 2018 6:22 PM

Answers

  • I figured out, that before migration we used wrong SENDER_ID hardcoded. We were using different projects for different environments with different project numbers. After upgrading to FCM we removed hardcoded SENDER_ID because now it's gotten from the google-services.json file during compilation.

    Azure Notification Hub has been reconfigured to use API key from the corresponding Firebase project and after that the OLD clients with SENDER_ID from other project became invalid.

    Fortunately, it's not related to the production environment :)

    Friday, August 17, 2018 4:41 PM