firebase-cloud-messaging

Firebase Cloud Messaging Migrate from legacy FCM APIs to HTTP v1


I am trying to migrate my android app. I followed the documentation and migrated everything else but stuck with token generation. I followed the following post https://stackoverflow.com/a/78575180/27368045 , and I am getting the following log getAccessToken: Error getting access token for service account: 400 Bad Request POST https://oauth2.googleapis.com/token {"error":"invalid_grant","error_description":"Invalid grant: account not found"} . I tested my json file using google cloud cli and I am successfully getting access token but don't understand why I am getting the above when using in my app. Can anybody make me undertand this issue , how with the same json I am able to get a token with cli but not in my app ? And how can I fix it ?

Migrate Firebase Messaging from legacy FCM APIs to HTTP v1


Solution

  • You need to add proguard rule as follows:-

    -keepclassmembers class * {
      @com.google.api.client.util.Key <fields>;
    }
    

    for all the rules you can check

    proguard-google-api-client