firebase / firebase/firebase-admin-dotnet

SubscribeToTopic() results in 401

Open
#439 1 comment 0 reactions 0 assignees View on GitHub
needs-triage
Dominant language
C#
Stars
408
Forks
146
Avg merge
22h 7m
Merged PRs (30d)
1

Description

### [READ] Step 1: Are you in the right place?

* For issues related to __the code in this repository__ file a Github issue.
* For general technical questions, post a question on [StackOverflow](http://stackoverflow.com/)
with the firebase tag.
* For general Firebase discussion, use the [firebase-talk](https://groups.google.com/forum/#!forum/firebase-talk)
google group.
* For help troubleshooting your application that does not fall under one
of the above categories, reach out to the personalized
[Firebase support channel](https://firebase.google.com/support/).

### [REQUIRED] Step 2: Describe your environment

* Operating System version: Ubuntu 22.04.5 LTS
* Firebase SDK version: 3.1.0
* Firebase Product: Firebase Cloud Messaging
* .NET version: 8.0.10
* OS: Ubuntu

### [REQUIRED] Step 3: Describe the problem
We have 2 projects on GCP, project A is used to host workloads on GKE, and project B is set with Firebase
We have a service/api that will handle notifications requests from client apps and will send them to FCM.
The authentication is done via ACD and workload federation, the SAs are given all permissions required.
We are able to send notification and data messages to the devices, but when we send a subscribe to topic request we get 401
#### Steps to reproduce:
1. intiialize the default instace for the app,
2. get the messaging service
3. use SubscribeToTopicAsync to subscribe a device/s to topic

#### Relevant Code:

```
FirebaseApp app = FirebaseApp.Create(
new AppOptions
{
ProjectId = firebase_project_id,
Credential = GoogleCredential.GetApplicationDefault(),
});
var firebaseMessaging= FirebaseMessaging.GetMessaging(app);

TopicManagementResponse response = firebaseMessaging
.SubscribeToTopicAsync(new[] { "device_token" }, "test_topic")
.GetAwaiter()
.GetResult();

```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure through FirebaseApp.Create, FirebaseMessaging.GetMessaging, and SubscribeToTopicAsync with the documented Ubuntu, .NET, SDK, and workload-federation setup. Compare the authentication and project configuration used for topic subscription with the successful message-sending path. Done means SubscribeToTopicAsync accepts the device token and topic without returning 401.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, authentication, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.