Open Closed

ImportFromExcel: Authentication bearer token has not been added by AbpHttpInterceptor #9642


0
BTH108 created

Prerequisites

  • What is your product version? AspNetZero v8.6
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .net core
  • What is ABP Framework version? AbpBoilerplate v5.6

Scenario

  1. I made a new component in my module to perform importing excel file. That I based on src/app/admin/users/users.component.ts.
  2. I keep the original configuration about AbpHttpInterceptor ONLY in ServiceProxy module.
  3. Result:
  • My component has not been intercepted by AbpHttpInterceptor, so the request does not have the Bearer token, and failed.

  • But, users.component.ts has been intercepted so it had token, and successfully done.

Question:

Please help me to explain how the request in user component is intercepted, but mine hasn't? *Both Admin module and MyModule module both do not import AbpHttpInterceptor.


2 Answer(s)
  • 0
    BTH108 created

    Could you @ismcagdas help me to explain how the Import Excel Request of User component can be intercepted by abpHttpInterceptor? Although AbpHttpInterceptor is only declared in Service Proxy module (v8.6).

  • 0
    ismcagdas created
    Support Team

    Hi,

    You can either add these two lines to your module which contains the component you are having problems with;

    https://github.com/aspnetzero/aspnet-zero-core/blob/dev/angular/src/shared/service-proxies/service-proxy.module.ts#L56-L57

    Or you can manually add token to request headers by getting the token using abp.auth.getToken() function.