程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ASP.NET Core 验证 Firebase Auth 模拟器 JWT大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决ASP.NET Core 验证 Firebase Auth 模拟器 JWT?

开发过程中遇到ASP.NET Core 验证 Firebase Auth 模拟器 JWT的问题如何解决?下面主要结合日常开发的经验,给出你关于ASP.NET Core 验证 Firebase Auth 模拟器 JWT的解决方法建议,希望对你解决ASP.NET Core 验证 Firebase Auth 模拟器 JWT有所启发或帮助;

我正在尝试验证 Firebase 身份验证模拟器发出的 JWT。以下代码片段适用于生产应用,但我不知道如何修改它,使其也适用于 Firebase 身份验证模拟器。

@H_403_3@services.AddAuthentication(JwtBearerDefaults.AuthenticationscheR_432_11845@E).AddJwtBearer(options =>
{
    options.Authority = "https://securetoken.Google.com/<project ID>";
    options.TokenValIDationParameters = new TokenValIDationParameters
    {
        ValIDateIssuer = true,Validissuer = "https://securetoken.Google.com/<project ID>",ValIDateAudIEnce = true,ValIDAudIEnce = "<project ID>",ValIDatelifetime = true
     };
});

我尝试了以下选项:

@H_403_3@services.AddAuthentication(JwtBearerDefaults.AuthenticationscheR_432_11845@E).AddJwtBearer(options =>
{
    options.requirehttpsMetadata = false;
    options.Authority = "http://localhost:9099";
    options.TokenValIDationParameters = new TokenValIDationParameters
    {
        ValIDateIssuer = true,Validissuer = "firebase-auth-emulator@example.com",ValIDAudIEnce = "https://IDentitytoolkit.GoogleAPIs.com/Google.IDentity.IDentitytoolkit.v1.IDentityToolkit",ValIDatelifetime = true,};
});

但我一直遇到以下错误:

@H_403_3@microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[3]
[dotnet-start]       Exception occurred while processing message.
[dotnet-start]       system.invalIdoperationException: IDX20803: Unable to obtain configuration from: 'System.String'.
[dotnet-start]        ---> System.IO.IOException: IDX20807: Unable to retrIEve document from: 'System.String'. httpResponsemessage: 'System.Net.http.httpResponsemessage',httpResponsemessage.Content: 'System.String'.
[dotnet-start]          at Microsoft.IDentitymodel.Protocols.httpdocumentRetrIEver.GetdocumentAsync(String address,CancellationToken cancel)
[dotnet-start]          at Microsoft.IDentitymodel.Protocols.OpenIDConnect.openIDConnectConfigurationRetrIEver.GetAsync(String address,IdocumentRetrIEver retrIEver,CancellationToken cancel)
[dotnet-start]          at Microsoft.IDentitymodel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)

我认为发行者和受众选项是正确的,但我找不到权限选项的正确值。有没有人知道使用 Firebase 身份验证模拟器进行这项工作的正确选项?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

大佬总结

以上是大佬教程为你收集整理的ASP.NET Core 验证 Firebase Auth 模拟器 JWT全部内容,希望文章能够帮你解决ASP.NET Core 验证 Firebase Auth 模拟器 JWT所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。