Refactor authentication flow
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma
2020-05-09 09:14:16 +02:00
parent 62887e8089
commit baf8767a91
5 changed files with 25 additions and 26 deletions

View File

@@ -27,17 +27,10 @@ export function appConfigFactory(injector:Injector, appConfig: AppConfig, oauthS
oauthService.configure(authconfigFactory.getAuthConfig(appConfig));
oauthService.setStorage(authStorage);
oauthService.setupAutomaticSilentRefresh();
let location = injector.get(Location);
let router = injector.get(Router);
let urlPath = location.path();
oauthService.loadDiscoveryDocument().then(() => {
oauthService.tryLoginCodeFlow().then(() => {
router.navigateByUrl((oauthService.state && oauthService.state!="")?decodeURIComponent(oauthService.state):urlPath);
});
})
}).then(() => {
}).then(() => oauthService.loadDiscoveryDocument()
).then(() => {
itemtypeService.load(appConfig).then(() => resolve()).catch(() => reject());
});
})
});
}
}