Created
June 24, 2016 18:11
-
-
Save tushargupta51/78ce0b6bce998f6851abd02d91eb3a95 to your computer and use it in GitHub Desktop.
App reloading inside iFrame when renewing token - Solution 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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 | |
); | |
}]); | |
} |
@nandun5, Have you resolved this issue? I am facing the same challenge that our application is loaded in another iframe and I am getting CORS error while getting access token.
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
How will this work if my SPA is actually loaded within an iframe of another application?