In the app.js file, I am initiating an OAuth Process within the device ready function using InAppBrowser. The process involves obtaining a token which is then checked to redirect to a specific view.
.run(function($ionicPlatform,$rootScope,$http,jwtHelper,$cordovaInAppBrowser,$state,jwtHelper) {
$ionicPlatform.ready(function() {
if(isValidUser)
{
$state.go('app.playlists');
window.location.reload(true);
}
}
However, the use of window.location.reload is causing an infinite loop when redirecting to the view. Simply using $state.go does not result in the desired redirection.
Additionally, including the following code:
$urlRouterProvider.otherwise('/app/playlists');
Causes the 'app.playlists' view to briefly appear for 2 seconds before displaying the oauth login screen inside the InAppBrowser. This is not the intended behavior.
What steps can be taken to resolve this issue?