【问题标题】:set access_token in httpheader in axios using typescript and webpack使用 typescript 和 webpack 在 axios 的 http 标头中设置访问令牌
【发布时间】:2018-10-23 02:53:22
【问题描述】:

我想在axios的header中设置access_token,如下所示。

https://github.com/axios/axios#global-axios-defaults

现在我正在使用仅在 CSHTML 文件中可用的 razor 语法获取 access_token。

https://github.com/IdentityServer/IdentityServer4.Samples/blob/release/Clients/src/MvcHybrid/Views/Home/Secure.cshtml

我正在使用带有 vue.js 的 typescript 使用 JavascriptServices

如何在我的打字稿文件(比如说 boot.ts)中设置(传递)这个 await Context.GetTokenAsync("access_token") 以设置为 axios 默认值。

【问题讨论】:

    标签: asp.net-mvc typescript razor single-page-application axios


    【解决方案1】:

    我遵循以下作为替代方案。所以不需要上面的用例。

    https://github.com/aspnet/Razor/issues/2347

    【讨论】:

      猜你喜欢
      • 2023-04-08
      • 2022-01-14
      • 2023-03-09
      • 2016-12-27
      • 2016-11-23
      • 2017-06-02
      • 2016-11-27
      • 1970-01-01
      • 2019-04-15
      相关资源
      最近更新 更多