Closed rotirk20 closed 4 years ago
@rotirk20 Can you please provide your angular route configuration
?
@rotirk20 Can you please provide your
angular route configuration
? @sameeragconst routes: Routes = [ { path: '', component: HomeComponent }, { path: 'login', component: LoginComponent }, { path: 'branch/:id', component: BranchInfoComponent }, { path: 'booking/:bookingBusiness', component: BookingComponent}, { path: 'dashboard', component: DashboardComponent, canActivate: [MsalGuard], children: [ { path: 'home', component: StatisticsComponent}, { path: 'branches', component: BranchesComponent }, { path: 'branch/:id/edit', component: EditBranchComponent }, { path: 'add-branch', component: AddBranchComponent }, { path: 'appointments', component: AppointmentsComponent }, { path: 'users', component: ManageUsersComponent }, { path: 'user/:id/edit', component: EditUserComponent }, { path: 'add-service', component: ServicesComponent }, { path: 'add-user', component: AddUserComponent }, { path: 'system', component: SystemComponent }, { path: 'settings', component: SettingsComponent } ] } ]
Solved..Removed MsalInterceptor from app.module because we don't use it on whole app only on few components like profile and etc..So we did use the endpoint for profile https://graph.microsoft.com/v1.0/me in which we send the accessToken which we get with this.broadcastService.subscribe('msal:acquireTokenSuccess')
Not fixed..I only get the token id type not the access token type..Is there any way to tell the msal interceptor to call only on specific routes?
@rotirk20 Yes, you can use the protectedResourceMap
to configure the MSAL Interceptor: https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-samples/angular9-sample-app/src/app/app.module.ts#L26
@jasonnutter That is correct! I set my link in protectedResourseMap with null security and it works! Thank you..
const protectedHost = 'link';
export const protectedResourceMap: [string, string[]][] = [
['https://graph.microsoft.com/v1.0/me', ['user.read']],
[protectedHost, null]
];
Library
msal@1.x.x
or@azure/msal@1.x.x
@azure/msal-browser@2.x.x
@azure/msal-angular@0.x.x
@azure/msal-angular@1.1.1
@azure/msal-angularjs@1.x.x
Important: Please fill in your exact version number above, e.g.
msal@1.1.3
.Framework
Angular
Description
The problem is that when we come to the front part of the page in which we didn't put in route msalGuard shows an error in console User login is required.For silent calls, request must contain either sid or login_hint.We are login with accounts who are connected to Azure AD.So somehow we need to set that Msal doesn't start at home page or first page..only on dashboard and admin part which is set with canActivate MsalGuard.Also If you refresh few times or log in into the dashboard and come back to the home everything starts to work from endpoints..And yes Locally everything works without problems only on production VM machine which is connected with AD Azure acc.
Error Message
User login is required.For silent calls, request must contain either sid or login_hint
Security
Regression
MSAL Configuration
Reproduction steps
Expected behavior
It should normally open the views which are not in MsalGuard.
Browsers/Environment