[英]How to Verify the integrity of the Google Identity Platform in C# with Google.Apis.Auth.AspNetCore3?
我已经设置了“Google Identity Platform”并且可以使用以下代码片段通过 firebase-ui web 获取访问令牌:
user.getIdToken().then(function (accessToken) {
console.log(accessToken);
});
现在我需要通过验证访问令牌来验证我的 ASP NET CORE 后端中的用户,但我找不到任何示例。
是否可以通过 Google.Apis.Auth.AspNetCore3 库来做到这一点? 什么是最好的解决方案?
注意:我不想为每个请求调用 tokeninfo 端点。
不需要 Google.Apis.Auth.AspNetCore3。 只需添加以下代码:
builder.Services
.AddAuthentication()
.AddJwtBearer("GoogleIdentityPlatformScheme", bearerOptions =>
{
bearerOptions.Authority = "https://securetoken.google.com/FIREBASE_PROJECT_ID";
bearerOptions.Audience = "FIREBASE_PROJECT_ID";
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.