Closed meron1122 closed 6 years ago
Do you use Routing in the hash fragment?
I am newbie in Angular, but i guess no. My routing:
export const routes: Routes = [
{
path: '',
redirectTo: 'page/dashboard',
pathMatch: 'full'
},
{
path: 'page',
component: FullLayoutComponent,
// canActivate: [AuthGuard],
data: {
title: 'Home'
},
children: [
{
path: 'dashboard',
loadChildren: './dashboard/dashboard.module#DashboardModule'
},
{
path: 'UsersList',
loadChildren: './users/users-list/users-list.module#UsersListModule'
},
{
path: 'MachinesList',
loadChildren: './machines/machines-list/machines-list.module#MachinesListModule'
},
{
path: 'MachinePrivileges',
loadChildren: './machines/machine-privileges/machine-privileges.module#MachinePrivilegesModule'
},
{
path: 'GroupsList',
loadChildren: './groups/groups-list/groups-list.module#GroupsListModule'
},
{
path: 'UserDetailDemo',
loadChildren: './users/user-details/user-details.module#UserDetailsModule'
}// ,
// { path: '**', redirectTo: 'dashboard' }
],
},
{ path: '**', redirectTo: 'dashboard' },
];
@NgModule({
imports: [RouterModule.forRoot(routes, {enableTracing: true, useHash: false})],
exports: [RouterModule]
})
export class AppRoutingModule {
}
Thx for this info. Can you check in your sample so that I can have a look at it?
Sample works fine, But funny thing: When i enable oidc, everything looks fine.
Did you turn it off before? I'm asking b/c it is on by default since some versions.
I am having a similar issue, except I am authenticating against Google and get the "state" can't be matched; Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'state'
BUT, I have 2 versions of the same application, and the first version works, the second doesn't. I can't find any differences in my code regarding OAuth. However, the application structure is quite different, so I suspect that there is something that is not called in the same order (or not at all) that is supposed to "take" the callback URI for processing.
If you have any pointers to docs that explains how the callback is handled in the library, or absent that, where in the code is the 'state' and 'access_token' URI parts being handled?
Hi @niclash Hi @meron1122
Can you provide a sample that shows that issue?
Can you try out this [1] with or without useHash:true
?
Best wishes, Manfred [1] https://manfredsteyer.github.io/angular-oauth2-oidc/angular-oauth2-oidc/docs/additional-documentation/routing-with-the-hashstrategy.html
If you send me your mail address to niclas@hedhman.org, I'll send you the whole thing (not very far yet)
As for routing-with-the-hashstrategy.html, I don't know how to use that, as I call initImplictFlow() on [login] click.
I just realized another difference between my two projects; Angular4 (works) and Angular5 (not working)
@manfredsteyer useHash:true
option(true/false) nothing change.
I have turned off oidc
manual.
But example attached in the sources library works fine.
My example is exacly this project(+ my some subpages) https://github.com/mrholek/CoreUI-Angular
@niclash In case of desperate i migrated project from 4 to 5 and doesn't help, but i guess, i cat forgot upgrade some lib :)
So, I added
RouterModule.forRoot(routes, {useHash: false, initialNavigation: false, enableTracing: true})
and in the setting up of oauth in app.component.ts
this.oauth.tryLogin().then(_ => { this.router.navigate(['/']); });
(which I don't understand the meaning of. Does it do the check when called or when implicitFlow reach that point?)
Anyway, I then pass the point of "can not match" and instead complaining about a missing "jwks parameter". But if I then remove the
this.oauth.tokenValidationHandler = new JwksValidationHandler();
then it redirects into the app (logged in).
I have gotten away from this. I ended up using hashStrategy because I was not paying attention. But I still can't get this library to work reliably. I am about to give up.
I configured as mentioned in getting started, and i redirected to my Oauth2 server, i login sucessfully but when i back to the angluar application i have issue
error cannot match any routes. URL Segment 'access token'
And redirect to login again. What i make wrong?