angularjs-oauth / oauth-ng

AngularJS directive for the OAuth 2.0 Implicit Flow
http://angularjs-oauth.github.io/oauth-ng/
MIT License
363 stars 156 forks source link

initView function calling logout in infinite loop #141

Open pottabathini opened 8 years ago

pottabathini commented 8 years ago

I am trying to integrate oauth-ng in my application by setting up manual configuration. we observe following issues.

  1. When it set request type 'token id_token' application blindly showing access denied link even my provider returns everything.
  2. When we set log-out URL the oauth-ng JS file initView checking for AccessToken when it is null it is calling for logout method. and this process repeating infinitely. When I check oauth-ng.js initView function it is expecting token to be available on initial page load only. if token not available then it calling logout. I put <oauth tag on landing page itself because of that initView calling on page loading and it calling infinitely logout URL.
baywet commented 7 years ago

having the same problem, I'm insterested into the fix.

baywet commented 7 years ago

I worked that around not using the directive's setting but rather implementing the logout event and doing the redirection myself. $rootScope.$on('oauth:logout', function() { if(!($rootScope.accessToken === null || $rootScope.accessToken === undefined)){//otherwise infinite redirect loop $rootScope.accessToken = null; var tempIdToken = $rootScope.idToken; $rootScope.idToken = null; var redirectLink = URLTOENDSESSIONENDPOINT+ '?post_logout_redirect_uri=' + POSTLOGOUTURL + '&id_token_hint=' + tempIdToken; $window.open(redirectLink, '_self'); } });