Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select legacy GCM or actual FCM endpoint for send based on the gcm_key #110

Merged
merged 2 commits into from
Apr 5, 2019
Merged

Select legacy GCM or actual FCM endpoint for send based on the gcm_key #110

merged 2 commits into from
Apr 5, 2019

Conversation

kilgoretrout1985
Copy link
Contributor

Hello,

As https://developers.google.com/cloud-messaging/android/android-migrate-fcm states: "As of April 10, 2018, Google has deprecated GCM. The GCM server and client APIs are deprecated and will be removed as soon as May 29, 2019."
So after may 29th posting to https://android.googleapis.com/gcm/send will not work.

But, as far as I understand, we can't just change line 311 to:

endpoint = 'https://fcm.googleapis.com/fcm/send'

as stated in paragraph 4 of android-migrate-fcm, because endusers of the pywebpush lib have to manually Import their GCM projects as a Firebase projects and receive new key (paragraph 1). Just changing the endpoint will break sending for those who still haven't switched from GCM to FCM even before May 29.

@jrconlin
Copy link
Member

jrconlin commented Apr 5, 2019

Thanks! First off, can you please fix the flake8 issue so the tests pass? I'll go deal with the crypto warning.

As weird as it is for me to say this, but I'm not quite sure guessing based on key length is the best way to go about this.

For what it's worth, on a different project we talked with google and found out that we could send GCM messages to the FCM endpoints and they'd basically work.

I think a better patch would be to add a flag that prefers GCM to talk to the old GCM endpoint and default GCM legacy folks to the FCM endpoint.

What do you think?

@kilgoretrout1985
Copy link
Contributor Author

Key len seems ok to me because of two reasons:

  1. https://stackoverflow.com/questions/41377108/what-is-the-difference-between-server-key-and-legacy-server-key-in-fcmfirebase Top answer there is theoretically from Firebase employee
  2. I have 4 old GCM projects that were imported and converted to FCM. Key length obviously differs.

Flag is also a good option as I think.

@jrconlin
Copy link
Member

jrconlin commented Apr 5, 2019

I'll file an issue to add the flag for legacy GCM. Thanks!

@jrconlin jrconlin self-requested a review April 5, 2019 16:29
@jrconlin jrconlin merged commit 4919ec1 into web-push-libs:master Apr 5, 2019
@jrconlin jrconlin removed their request for review April 5, 2019 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants