firebase / firebase/firebase-admin-go

SubscribeToTopic() results in 401

Open
#533 8 comments 2 reactions 0 assignees View on GitHub
api: messaging
Dominant language
Go
Stars
1.3k
Forks
274
Avg merge
10h 39m
Merged PRs (30d)
2

Description

### [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{
"",
}, "anyTopic")
```

Results in the error:

```
unexpected http response with status: 401\n\n\nUnauthorized\n\n\n

Unauthorized

\n

Error 401

\n\n\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.

![image](https://user-images.githubusercontent.com/511342/211426709-fffe4f08-3181-42c8-89ee-a37c871375c7.png)

Did I miss something super obvious in configuration?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.