Skip to content

Instantly share code, notes, and snippets.

@tushargupta51
Created June 24, 2016 18:11
Show Gist options
  • Save tushargupta51/78ce0b6bce998f6851abd02d91eb3a95 to your computer and use it in GitHub Desktop.
Save tushargupta51/78ce0b6bce998f6851abd02d91eb3a95 to your computer and use it in GitHub Desktop.
App reloading inside iFrame when renewing token - Solution 1
'use strict';
if (window !== window.parent) {
angular.module('todoApp', ['AdalAngular'])
.config(['$httpProvider', 'adalAuthenticationServiceProvider', function ($httpProvider, adalProvider) {
adalProvider.init(
{
clientId: 'Enter your client ID here e.g. e9a5a8b6-8af7-4719-9821-0deef255f68e',
},
$httpProvider
);
}]);
}
else {
angular.module('todoApp', ['ngRoute','AdalAngular'])
.config(['$routeProvider', '$httpProvider', 'adalAuthenticationServiceProvider', function ($routeProvider, $httpProvider, adalProvider) {
$routeProvider.when("/Home", {
controller: "homeCtrl",
templateUrl: "/App/Views/Home.html",
}).when("/TodoList", {
controller: "todoListCtrl",
templateUrl: "/App/Views/TodoList.html",
requireADLogin: true,
}).when("/UserData", {
controller: "userDataCtrl",
templateUrl: "/App/Views/UserData.html",
}).otherwise({ redirectTo: "/Home" });
adalProvider.init(
{
instance: 'https://login.microsoftonline.com/',
tenant: 'Enter your tenant name here e.g. contoso.onmicrosoft.com',
clientId: 'Enter your client ID here e.g. e9a5a8b6-8af7-4719-9821-0deef255f68e',
extraQueryParameter: 'nux=1',
//cacheLocation: 'localStorage', // enable this for IE, as sessionStorage does not work for localhost.
},
$httpProvider
);
}]);
}
@chetanc97
Copy link

For me this goes into infinite looping reloading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment