Skip to content

Access token doesn't handled in router configured with "useHash: true" #211

@bezigon

Description

@bezigon
* Navigated to http://localhost:4200/
router_module.js:224 -> Router Event: NavigationStart
router_module.js:225 -> NavigationStart(id: 1, url: '/')
lang.js:124 -> Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.
router_module.js:224 -> Router Event: RoutesRecognized
router_module.js:225 -> RoutesRecognized(id: 1, url: '/', urlAfterRedirects: '/home', state: Route(url:'', path:'') { Route(url:'home', path:'home') } )
router_module.js:224 -> Router Event: NavigationEnd
router_module.js:225 -> NavigationEnd(id: 1, url: '/', urlAfterRedirects: '/home')
* Navigated to https://accounts.google.com/AccountChooser?(…)
* Navigated to http://localhost:4200/
router_module.js:224 -> Router Event: NavigationStart
router_module.js:225 -> NavigationStart(id: 1, url: '/access_token')
lang.js:124 -> Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.
router_module.js:224 -> Router Event: RoutesRecognized
router_module.js:225 -> RoutesRecognized(id: 1, url: '/access_token', urlAfterRedirects: '/access_token', state: Route(url:'', path:'') { Route(url:'access_token', path:'**') } )
router_module.js:224 -> Router Event: NavigationEnd
router_module.js:225 -> NavigationEnd(id: 1, url: '/access_token', urlAfterRedirects: '/access_token')
router_module.js:224 -> Router Event: NavigationStart
router_module.js:225 -> NavigationStart(id: 2, url: '/')
router_module.js:224 -> Router Event: RoutesRecognized
router_module.js:225 -> RoutesRecognized(id: 2, url: '/', urlAfterRedirects: '/home', state: Route(url:'', path:'') { Route(url:'home', path:'home') } )
router_module.js:224 -> Router Event: NavigationEnd
router_module.js:225 -> NavigationEnd(id: 2, url: '/', urlAfterRedirects: '/home')
auth.service.ts:36 -> [LOG lock on] authenticated => Object {accessToken: "", idToken: undefined, idTokenPayload: undefined, refreshToken: undefined, state: undefined}
auth.service.ts:40 -> [LOG lock get profile] error => Error: Invalid token(…)
auth.service.ts:24 -> [LOG tokenNotExpired try/catch ex] Error: JWT must have 3 parts(…)
router_module.js:224 -> Router Event: NavigationStart
router_module.js:225 -> NavigationStart(id: 3, url: '/')
router_module.js:224 -> Router Event: RoutesRecognized
router_module.js:225 -> RoutesRecognized(id: 3, url: '/', urlAfterRedirects: '/home', state: Route(url:'', path:'') { Route(url:'home', path:'home') } )
router_module.js:224 -> Router Event: NavigationEnd
router_module.js:225 -> NavigationEnd(id: 3, url: '/', urlAfterRedirects: '/home')

Whereas for router configured with "useHash: false" all is working fine.

Solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions