如何使用web api2控制器进行firebase令牌认证

时间:2022-02-02 23:14:11

I have a firebase authentication token that i am trying to pass to a web api controller. I am following this post here. *post

我有一个firebase身份验证令牌,我试图传递给web api控制器。我在这里关注这篇文章。 *post

I have the bearer token in the $http request headers. 如何使用web api2控制器进行firebase令牌认证

我在$ http请求标头中有持有者令牌。

I took care of cors(unless I missed something). The end point in my api project is receiving the request with null headers. So I am trying to debug what is wrong but without any specific errors I am not sure where to look 如何使用web api2控制器进行firebase令牌认证

我照顾了科尔(除非我错过了什么)。我的api项目中的终点是接收带有null头的请求。所以我试图调试错误但没有任何具体错误,我不知道在哪里看

1 个解决方案

#1


2  

You can get the value of an element "Authorization" in header by using following code:

您可以使用以下代码在标头中获取元素“Authorization”的值:

  string firebaseAuthToken = string.Empty;
    firebaseAuthToken = actionContext.Request.Headers.GetValues("Authorization").First();

#1


2  

You can get the value of an element "Authorization" in header by using following code:

您可以使用以下代码在标头中获取元素“Authorization”的值:

  string firebaseAuthToken = string.Empty;
    firebaseAuthToken = actionContext.Request.Headers.GetValues("Authorization").First();