Попытка аутентификации с помощью Azure AD из моего Angular приложения. Это так сложно понять, как это сделать, потому что в Интернете так много устаревших примеров. Я следил за самой современной документацией по github, но я продолжаю получать эту ошибку при доступе к приложению:
ClientConfigurationError: No redirect callbacks have been set. Please call handleRedirectCallback() with the appropriate function arguments before continuing
Что мне нужно сделать, чтобы оно работало?
app-routing.module.ts
const routes: Routes = [
{ path: '', component: AppComponent, canActivate: [MsalGuard] },
{ path: 'auth-callback', component: DashboardComponent }
];
app.module.ts
const config = {
auth: {
clientId: 'my-client-id',
//popUp: true,
consentScopes: ['https://graph.microsoft.com/User.ReadWrite'],
redirectUri: 'http://localhost:4200/auth-callback',
}
};
@NgModule({
declarations: [
AppComponent,
DashboardComponent
],
imports: [
MsalModule.forRoot(config),
BrowserModule,
AppRoutingModule
],
providers: [
{
provide: HTTP_INTERCEPTORS,
useClass: MsalInterceptor,
multi: true
}
]
,
bootstrap: [AppComponent]
})
export class AppModule {
constructor() {
const myMSALObj = new UserAgentApplication(config);
function authCallback(error, response) { }
myMSALObj.handleRedirectCallback(authCallback);
}