Created
May 14, 2020 20:51
-
-
Save manoj-choudhari-git/4fedd960b7242823ad9f505d032a9794 to your computer and use it in GitHub Desktop.
App Module For Azure AD B2C Protected Angular App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { BrowserModule } from '@angular/platform-browser'; | |
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | |
import { NgModule } from '@angular/core'; | |
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http'; | |
import { msalConfig, msalAngularConfig } from './app-config'; | |
import { AppRoutingModule } from './app-routing.module'; | |
import { AppComponent } from './app.component'; | |
import { NavMenuComponent } from './nav-menu/nav-menu.component'; | |
import { HomeComponent } from './home/home.component'; | |
import { CounterComponent } from './counter/counter.component'; | |
import { FetchDataComponent } from './fetch-data/fetch-data.component'; | |
import { Configuration } from 'msal'; | |
import { | |
MsalModule, | |
MsalInterceptor, | |
MSAL_CONFIG, | |
MSAL_CONFIG_ANGULAR, | |
MsalService, | |
MsalAngularConfiguration | |
} from '@azure/msal-angular'; | |
function MSALConfigFactory(): Configuration { | |
return msalConfig; | |
} | |
function MSALAngularConfigFactory(): MsalAngularConfiguration { | |
return msalAngularConfig; | |
} | |
@NgModule({ | |
declarations: [ | |
AppComponent, | |
NavMenuComponent, | |
HomeComponent, | |
CounterComponent, | |
FetchDataComponent | |
], | |
imports: [ | |
BrowserModule, | |
HttpClientModule, | |
MsalModule, | |
AppRoutingModule | |
], | |
providers: [ | |
{ | |
provide: HTTP_INTERCEPTORS, | |
useClass: MsalInterceptor, | |
multi: true | |
}, | |
{ | |
provide: MSAL_CONFIG, | |
useFactory: MSALConfigFactory | |
}, | |
{ | |
provide: MSAL_CONFIG_ANGULAR, | |
useFactory: MSALAngularConfigFactory | |
}, | |
MsalService | |
], | |
bootstrap: [AppComponent] | |
}) | |
export class AppModule { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment