通过 NESTJS 应用程序完成的 POST 调用中缺少授权标头
这种情况是,我试图从我的 NESTJS 应用程序访问 .NET-Core 应用程序中的 API,而在执行此操作时,.Net-Core 端缺少 Authorization 标头。其余的所有标头都已附加,只是缺少此 Authorization 标头
我正在使用 nestjs/axios 库发送 POST 调用,在 .Net-Core 端我有在 CORS 策略中添加了所有必需的标头。
问题:-
在NESTJS中,我有一个服务,比方说,DemoService
我使用nestjs/axios调用api,如下所示:
this.httpService.post(url, data, config); // config = {headers: {'Authorization': "bearer", "abc": "abc"}}
在.Net端有一个<强>中间件,我试图像这样读取授权标头:-
var bearer = context.Request.Headers["Authorization"];
但是这个承载者是空的。
在这方面需要一些帮助。
The scenario is that I am trying to hit an API which is in .NET-Core application from my NESTJS application and the while doing that the Authorization header is missing in the .Net-Core side. Rest all the headers are getting attached just this Authorization header is missing
I am using the nestjs/axios library to send the POST call and in the .Net-Core Side I have added all the required headers in CORS policy.
Problem:-
In NESTJS, I have a service, let's say, DemoService
I am calling an api using nestjs/axios like this:
this.httpService.post(url, data, config); // config = {headers: {'Authorization': "bearer", "abc": "abc"}}
And in .Net side there is a middleware where I am trying to read the Authorization header like this:-
var bearer = context.Request.Headers["Authorization"];
But this bearer is coming as empty.
Need some help on this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论