2016-06-16 3 views
1
this tutorial and working example 당 그래서, 나는 이전에 (라우팅은 완벽하게 잘 작동하는) 내 app.js 파일에이 함수를 호출했다

라우팅 하여 튜토리얼 요청과 같은 코드 다음이 줄을 추가 (직접 .otherwise({ redirectTo: '/home' }); 후 :adalProvider.init (..) 파괴

adalProvider.init(
    { 
     instance: 'https://login.microsoftonline.com/', 
     tenant: '...', //Removed 
     clientId: '...', //Removed 
     extraQueryParameter: 'nux=1', 
     //cacheLocation: 'localStorage', // enable this for IE, as sessionStorage does not work for localhost. 
    }, 
    $httpProvider 
); 

... 나는 다음과 같은 오류를 얻을 :

angular.js:13424 Error: [$compile:tpload] Failed to load template: app/views/_header.html (HTTP status: undefined undefined) http://errors.angularjs.org/1.5.3/ $compile/tpload?p0=app%2Fviews%2F_header.html&p1=undefined&p2=undefined at angular.js:68 ...[truncated by user for readability]

angular.js:13424 TypeError: Cannot read property 'push' of undefined at routeChangeHandler (adal-angular.js:213) ...[truncated by user for readability]

angular.js:13424 Error: [$compile:tpload] Failed to load template: /app/views/home.html (HTTP status: undefined undefined) http://errors.angularjs.org/1.5.3/ $compile/tpload?p0=%2Fapp%2Fviews%2Fhome.html&p1=undefined&p2=undefined at angular.js:68 ...[truncated by user for readability]

,691을

여러 StackOverflow 질문은 이미 # 1과 # 3 오류 메시지를 처리하지만 경로가 올바른지 확인하는 것이 좋습니다. 파일이 있다는 것을 확인할뿐만 아니라 (브라우저를 직접 가리킴으로써), 앞서 언급했듯이 adalProvider.init(..) 경로가 정상으로 돌아 가지 않습니다.

npm 패키지 버전 1.0.10에 포함 된 최신 버전의 adal.js 및 adal-angular.js를 실행하고 있습니다.

무엇이 여기에 있습니까? adalProvider.init(..)을 구현하면서 작업 지시로 돌아가려면 무엇을 수정할 수 있습니까?

답변

2

Angular/Adal.js와 비슷한 문제가있었습니다. ng-route 대신 ui-router를 사용하고 ng-route로 스와핑하여 문제를 해결할 수 있는지 확인했습니다 (템플리트 URI를 해결하는 것과 관련이 있다는 것을 알았습니다). 그러나 문제는 남아있었습니다. 내 솔루션은 라우팅뿐만 아니라 adal 설정과 관련이없는 것 같기 때문에 내 솔루션이 잘 작동 할 수 있다고 생각합니다.

익명 엔드 포인트와 내 설정을 업데이트, 인증에 의해 차폐되지 않는 부분 지문 :

var anonymousEndpoints = [ 
     'partials/public/' 
    ]; 

    var endpoints = { 
     // Map the location of a request to an API to a the identifier of the associated resource 
     'https://contosotogo.azurewebsites.net/': 'https://contoso.onmicrosoft.com/ToGoAPI' 
    }; 

adalAuthenticationServiceProvider.init(
    { 
    tenant: '__removed__', 
    clientId: '__removed__', 
    anonymousEndpoints: anonymousEndpoints, // Added this 
    endpoints: endpoints 
    }, 
    $httpProvider 
); 

내가 Angulars에 저장되어있는 템플릿을 파악 알 수없는 키/상태를 통해 templatecache 및 인증되지 동안 검색 할 수 없습니다. 그들은 인증을 필요로하지 않기 때문에, 나는 그것들을 꺼냈다. 이것은 또한 만료 된 토큰을 갱신하는 동안 무한 루프 문제를 해결 한 것으로 보입니다 (https://github.com/AzureAD/azure-activedirectory-library-for-js/issues/216).

솔직히 나는 adal.js를 구현하는 데 많은 어려움에 직면 해 왔습니다. 작업에 물건을 얻기,

는 희망이 도움이 ...

+0

안녕하세요, 난 여전히 같은 문제에 직면하고 환호에 유래/github에와 홀수 자습서/예를 수색 노력하고있다 내가 설정 한 후, 내 경로가 작동하지 않습니다 init. 다음과 같이 끝점과 익명 Endpoint를 추가했습니다. var anonymousEndpoints = [ 'requeue/app/template /' ]; var endpoints = { // API에 대한 요청 위치를 연결된 리소스의 식별자에 매핑 'https://contosotogo.azurewebsites.net/': 'https://contoso.onmicrosoft.com/ ToGoAPI ' }; 다음과 같이 오류가 발생했습니다 angular.js : 14700 TypeError : null (...)의 'data'속성을 읽을 수 없습니다. "아마도 처리되지 않은 거부 : {}" 도와 주시겠습니까? –