Raudius / Pushraven

A simple Java library to interface with Firebase Cloud Messaging (FCM) API. Pushraven allows you to push notifications to clients in very few lines of code.
MIT License
78 stars 34 forks source link

Which version is the latest? #22

Closed fuj1w4r4 closed 6 years ago

fuj1w4r4 commented 6 years ago

I check in maven, 1.1.0 is the latest. It is kinda confusing. Please advise.

in the version 1.0.1, it throws me this error:

Caused by: java.io.IOException: Server returned HTTP response code: 411 for URL: https://fcm.googleapis.com/v1/projects/olemojo-demo-fire/messages:sendResponse Code: 411

java.io.IOException: Error reading credentials from stream, 'type' field not specified. at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.fromStream(GoogleCredential.java:254) at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.fromStream(GoogleCredential.java:226) at us.raudi.pushraven.Pushraven.getAccessToken(Pushraven.java:132) at us.raudi.pushraven.Pushraven.push(Pushraven.java:78) at com.mojo.controller.PublicController.testPushRaven(PublicController.java:91)

Raudius commented 6 years ago

I did fudge up the releases at some point. With the next release I'll probably name it 2.0 to fix it.

The error that you are getting would be because your Google Credential "service_account.json" file is missing the 'type' field.

fuj1w4r4 commented 6 years ago

hey thanks, my bad. I didn't use the correct json file.

Raudius commented 6 years ago

No worries, glad I could help.

KaiSheng714 commented 6 years ago

I faced the same problem, and got 411 error code with message "that’s an error. post requests require a content-length header"

After tried, I found I used wrong json file, too.

To generate a valid .json, follow the instructions: https://firebase.google.com/docs/cloud-messaging/auth-server

I hope it can help someone else.