Firebase Cloud Messaging授权失败

I'm currently trying to implement a server in Go working with Firebase Cloud Messaging. I inserted my API key and sender ID (which I both got from the Firebase console at Project Settings -> Cloud Messaging) and did this:

err := gcm.Listen(senderID, apiKey, onMessageReceived, nil)

and all I get is this

error creating xmpp client>error connecting client>auth failure: not-authorized

I'm using the same library Google's using in it's examples. Is the library maybe not working with FCM yet or am I doing something wrong?

If it's the library, how would I implement this without it?

This library will works perfectly with firebase, if you do several things:

  1. Change xmppHost from https://gcm-http.googleapis.com/gcm/send to https://fcm.googleapis.com/fcm/send
  2. Add new const xmppDomain = "gcm.googleapis.com"
  3. Change function xmppUser, it should be like
func xmppUser(senderId string) string {
    return senderId + "@" + xmppDomain
}