I am developing a web application using Angular 7 and this app communicates to a Web API back-end services written in dot.net core.
These two applications have been deployed to Azure and all its configurations has been set up: resource group, enable CORS, Azure AD, etc...
The problem I am facing is at the moment to consume the endpoints, lets say to do a normal get. I am getting a 401 http error which make sense. So, I starting implementing Adal.js in my Angular App to let the user authenticate to the Azure Active Directory, get the token and inject the token on the Request Header (following this post: Using ADAL.js with Angular4+). However, I am getting this error:
adal.services.ts
import { Injectable } from '@angular/core';
import { adal } from 'adal-angular';
import { Observable, Subscriber } from 'rxjs';
import { retry } from 'rxjs/operators';
import { AdalConfigService } from './adal-config.service';
declare var AuthenticationContext: adal.AuthenticationContextStatic;
let createAuthContextFn: adal.AuthenticationContextStatic = AuthenticationContext;
@Injectable({
providedIn: 'root',
})
export class AdalService {
private context: adal.AuthenticationContext;
constructor(private configService: AdalConfigService) {
this.context = new createAuthContextFn(configService.adalSettings);
}
I already have the following Adal.js packages installed: npm install adal-angular npm install @type/adal-angular
Has anyone face a similar issue? Any help is very welcome