Open simo3o opened 7 years ago
I would like to know this too, can you use this with ui-router at all?
Hi guys. I made a lot of changes for this to work with the latest version of IdentityServer4. I also created a Sign Up button option for my personal use.
I changed this part of code in order to use it with ui-router:
// Open ID Sign In directive
angular.module('oauth2.directive', [])
.config(['$stateProvider', function ($stateProvider) {
$stateProvider
.state('silent-renew', {
name: 'SilentRenew',
url: '/silent-renew',
template: ''
})
}])
On function init() I changed:
$rootScope.$on('$stateChangeStart', stateChangeHandler);
and the "routeChangeHandler" function I changed for:
function stateChangeHandler(event, toState, toParams, fromState, fromParams, options) {
if (toState && toState.requireToken) {
if (!accessToken.get() || expired(accessToken.get())) {
event.preventDefault();
$window.sessionStorage.setItem('oauthRedirectRoute', toState.url);
if (scope.signUpMode) {
endpoint.signUp();
} else {
endpoint.authorize();
}
}
}
};
Good luck. Let me know if it works for you.
Is it possible to use the requireToken: true with ui-router?