Authentication Error
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 冷清
- 技术栈
- csharp, firebase
调研方向
从第 67 行的 FirebaseClient.cs 调用开始,跟踪它经过 FirebaseMessaging.SendAsync 和 ErrorHandlingHttpClient.SendAndReadAsync 的流程。将 FirebaseApp 的 credential 设置与 issue 中显示的 scoped credential access-token 检查进行比较。完成的标准是确定请求缺少身份验证的原因,并确认修正后的 messaging 请求成功。
由索引模型根据 Issue 内容生成。
描述
FirebaseAdmin: 3.4.0
.NET Version: 10
My firebase messaging stopped working all suddenly, no code changes, Firebase Messaging API enabled, Service Account credential is active.
Setup code in my service
var credential = CredentialFactory.FromFile<ServiceAccountCredential>(options.Value.FIREBASE_ADMIN_FILE);
_app = FirebaseApp.Create(new AppOptions()
{
Credential = credential.ToGoogleCredential(),
});
_messaging = FirebaseMessaging.GetMessaging(_app);
When attempting to send a message, I now get the errors below:
FirebaseAdmin.Messaging.FirebaseMessagingException: Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
at FirebaseAdmin.Util.ErrorHandlingHttpClient`1.SendAndReadAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at FirebaseAdmin.Util.ErrorHandlingHttpClient`1.SendAndDeserializeAsync[TResult](HttpRequestMessage request, CancellationToken cancellationToken)
at FirebaseAdmin.Messaging.FirebaseMessagingClient.SendAsync(Message message, Boolean dryRun, CancellationToken cancellationToken)
at FirebaseAdmin.Messaging.FirebaseMessaging.SendAsync(Message message, Boolean dryRun, CancellationToken cancellationToken)
at FirebaseAdmin.Messaging.FirebaseMessaging.SendAsync(Message message, CancellationToken cancellationToken)
at NoWow.EmailService.FirebaseClient.NotifyAsync(Guid userId, String token, String title, String body, Dictionary`2 data, CancellationToken cancellationToken) in /src/src/NoWow.EmailService/FirebaseClient.cs:line 67
To confirm my credentials is valid I did:
var credential = CredentialFactory.FromFile<ServiceAccountCredential>(options.Value.FIREBASE_ADMIN_FILE).ToGoogleCredential().CreateScoped(
"https://www.googleapis.com/auth/firebase.messaging",
"https://www.googleapis.com/auth/cloud-platform");
var accessTokenForRequestAsync = await credential.UnderlyingCredential.GetAccessTokenForRequestAsync();
Console.WriteLine("Access token: {0}", accessTokenForRequestAsync);
The above test returned an access token confirming my credentials are valid
- 主要语言
- C#
- 星标
- 407
- 派生
- 147
- 平均合并
- 2 天 10 小时
- 30 天内合并 PR
- 12
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
firebase/firebase-admin-dotnet 的其他 Issue
-
AbstractFirebaseAuth.cs has a typo (accound/account)可能重新可做 关联的 PR 已关闭且未合并。 未关闭needs-triage
难度 1/5 1 小时以内 新手友好度 72/100
firebase/firebase-admin-dotnet#334 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 42/100
firebase/firebase-admin-dotnet#591 · 1 个 reaction ·
维护者通常 1 天内回复
-
GetProjectId returns null on Compute Engine / Cloud Run with application default credentials可能已有人在做 @lahirumaramba 于 3 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 78/100
firebase/firebase-admin-dotnet#588 ·
维护者通常 1 天内回复
-
Sending FCM notification with Fids Return NotRegistered可能重新可做 @yvonnep165 于 80 天前认领,目前没有进行中的 PR。 未关闭
firebase/firebase-admin-dotnet#534 · 5 条评论 · 1 个 reaction · 已指派 1 人 ·
维护者通常 1 天内回复
-
Sending MulticastMessage does not work after replacing Tokens with Fids可能重新可做 @Doris-Ge 于 108 天前认领,目前没有进行中的 PR。 未关闭api: messaging
firebase/firebase-admin-dotnet#530 · 2 条评论 · 已指派 2 人 ·
维护者通常 1 天内回复
查看 firebase/firebase-admin-dotnet 的全部 Issue
相似的 Issue
-
enhancement needs-triage
难度 2/5 1-3 小时 新手友好度 78/100
microsoft/microsoft-ui-reactor#1460 ·
维护者通常 1 天内回复
-
t/bug
难度 2/5 1-3 小时 新手友好度 75/100
dotnet/maui#39950 · 1 个 reaction ·
维护者通常 1 天内回复
-
The server's default HttpClient fails on plain http and on HTTPS servers without HTTP/2可能已有人在做 @yasmoradi 今天认领。 未关闭area / templates
难度 2/5 1-3 小时 新手友好度 73/100
bitfoundation/bitplatform#14659 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
CommunityToolkit/Datasync#600 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
NimblePros/deviq-hugo#121 ·
维护者通常 1 天内回复