2

I'm using azure MSAL to authenticate my API but problem is that I'm using DevExtreme custom store for server side pagination.

Msal Interceptor works and genrate token auto for HttpClient but in this case I'm not sending request via http.

If I'm using access token that I get after login then error occur Invalid signature and if If used IdToken then 401 how I can solve this problem.

MSALInterceptorConfigFactory:

protectedResourceMap.set('https://localhost:44379/api/approveMilestones', ['api://cb343c76-cd5b-4af6-8229-014b2522adab/access_as_user']);

Login Response where I'm getting accessToken and IdToken

this.authService.loginPopup()
  .subscribe((response: AuthenticationResult) => {
    AuthenticationHelper.setToken(response.accessToken);
    this.router.navigate(['/payments-approval']);
  });

I'm getting accessToken and IdTOken both in result but these are not working if i send them with request for Bearer

Amir Sohail
  • 21
  • 1
  • 3

1 Answers1

-1

While sending the request to the server the scopes are empty when going the cross-domain. You can create your own interceptor from small-angular and then you can inject the code in development mode.

First store the token in the localStorage:

localStorage.setItem ('token', result.token);

While sending the request to the server get the token from the browser

const token = localStorage.getItem (‘token'); and send the token with the request like this.

Read more here.

Rutha
  • 751
  • 3
  • 7