Lets say I have Google Cloud Project (GCP1) with GCM turned on with Client id P1.
Now I have created a standalone Firebase project F2 WITHOUT importing it to GCP1. I
When sending messages from your back-end server, you need to authenticate the request with the API-KEY associated with project (sender-id) used to generate the GCM/FCM token.
Due to security restrictions here are no workaround for this.
For existing GCM users the best migration consists in importing the old project into the Firebase Console. This will allow you to target both old and new client, since the sender-id
will not change
Steps here: https://developers.google.com/cloud-messaging/android/android-migrate-fcm
If that is not option (you have already created a new Firebase Project distinct from the previous Google Cloud Project) you have two possibilities:
Easier and recommended approach: change your back-end to store which client originated the gcm/fcm token. Then use the correct API-KEY when sending messages from your back-end. (the API-KEY associated to the old project for old clients, and the new API-KEY for new clients that are using the new Firebase project).
If you cannot change your back-end at all: in FCM you can create an additional token for the old SenderID, using the API:
FirebaseInstanceId.getInstance().getToken("old-sender-id", "FCM")
Because this token is associated to the old-sender-id your back-end will be able to send messages to it using the API-KEY of the old project.
Note: this doesn't affect the Firebase Console which is based on the new-sender-id.
That console will be able to target only the new clients that are including the firebase sdk and the associated google_services.json file.