I'm having troubles with sending push-notifications after migrating to FCM V1
I did everything that migration docs say https://firebase.google.com/docs/cloud-messaging/migrate-v1
Here is what my token creation code looks like (C#)
async Task<string> GetAuthToken()
{
var firebaseCredentialsPath = Environment.GetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS");
if (firebaseCredentialsPath != null)
{
GoogleCredential credential;
using (var stream = new System.IO.FileStream(firebaseCredentialsPath,
System.IO.FileMode.Open, System.IO.FileAccess.Read))
{
credential = GoogleCredential.FromStream(stream).CreateScoped("https://www.googleapis.com/auth/firebase.messaging");
}
return await ((ITokenAccess)credential).GetAccessTokenForRequestAsync();
}
return string.Empty;
}
And here is how I send the request (Postman for better visual representation)
I am sure that the json file used for token generation belongs to a service account of the project that is mentioned in the request URL (marked with red in the screenshots).
Token is added as a bearer token in Postman (check the screenshots)
What can be the cause of the issue? Any ideas?
As Joe Spiro mentioned, there are two types of tokens Access token and device token.
Both tokens should be generated using the same Firebase project. Issue happened because device token was generated using another Firebase project.
But the error message is misleading and wrong by saying that sender id is wrong. It's the recipient ID (device token) wrong, not sender ID.