Skip to content

Firebase/GCM push is returning 401 error even though a curl request works as expected #346

@petergzli

Description

@petergzli

I believe I set up everything correctly, and trying to test with a simple one device registration ID push. However, I keep getting the 401 error even though I know for a fact the keys work, i.e. I do a regular curl on http://fcm.googleapis.com/fcm/send using the SAME server_key I set up for the Rpush::Gcm::App as well as the same registration ID I intended to send the message to. Because the curl works perfectly, I don't think it's actually an auth_key issue even though Rpush keeps telling me Unauthorized, check your App auth_key.

Any ideas what I could have done to set it up incorrectly?

I set up the new app like so...
app = Rpush::Gcm::App.new
app.name = "android_app"
app.auth_key = "..."
app.connections = 1
app.save!

And tested a push like so...

n = Rpush::Gcm::Notification.new
n.app = Rpush::Gcm::App.find_by_name("android_app")
n.registration_ids = ["..."]
n.data = { message: "hi mom!" }
n.save!

Rpush.push returns the 401...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions