SubscribeToTopic() results in 401
kevmo314 opened this issue · comments
[REQUIRED] Step 2: Describe your environment
- Operating System version:
$ uname -a
Linux Chicago 5.15.79.1-microsoft-standard-WSL2 #1 SMP Wed Nov 23 01:01:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
- Firebase SDK version: firebase.google.com/go/v4 v4.10.0
- Library version: v4.10.0
- Firebase Product: messaging
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
app, err := firebase.NewApp(context.Background(), &firebase.Config{
ProjectID: projectID,
})
fcm, err := app.Messaging(context.Background())
if err != nil {
panic(err)
}
...
fcm.SubscribeToTopic(context.Background(), []string{
"<valid token>",
}, "anyTopic")
Results in the error:
unexpected http response with status: 401\n<HTML>\n<HEAD>\n<TITLE>Unauthorized</TITLE>\n</HEAD>\n<BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\">\n<H1>Unauthorized</H1>\n<H2>Error 401</H2>\n</BODY>\n</HTML>\n
Inspecting this further, based on the documentation here: https://developers.google.com/instance-id/reference/server#manage_relationship_maps_for_multiple_app_instances
I would expect that /iid/v1:batchAdd
gets called with the corresponding parameters. However, it doesn't have an authorization header.
Did I miss something super obvious in configuration?