2016-06-02 2 views
2

저는 ionic2 (및 angular2)로 새롭고 첫 번째 앱에서 auth0을 구현하려고합니다. 그래서 나는 이것을 따라 갔다. https://auth0.com/docs/quickstart/hybrid/ionic2/no-api빠른 시작 Auth0 with Ionic2

나는 ionic2 웹 사이트에서 "시작하기"로 시작했고 모든 것이 완벽하게 작동한다. 그런 다음 나는 auth0 빠른 시작의 모든 단계를 수행하지만 내가 할 때이 오류가 얻을 "이온 성 역할"

import {App, Platform} from 'ionic-angular'; 
import {StatusBar} from 'ionic-native'; 
import {TabsPage} from './pages/tabs/tabs'; 
import {provide} from 'angular2/core'; 
import {Http} from 'angular2/http' 
import {AuthHttp, AuthConfig} from 'angular2-jwt'; 
import {AuthService} from './services/auth/auth'; 
import {Type} from 'angular2/core'; 


@App({ 
    template: '<ion-nav [root]="rootPage"></ion-nav>', 
    config: {}, 
    providers: [ 
     provide(AuthHttp, { 
      useFactory: (http) => { 
       return new AuthHttp(new AuthConfig(), http); 
      }, 
      deps: [Http] 
     }), 
     AuthService 
    ], 
}) 
export class MyApp { 
rootPage: any = TabsPage; 

constructor(platform: Platform) { 
    platform.ready().then(() => { 
     StatusBar.styleDefault(); 
     // When the app starts up, there might be a valid 
     // token in local storage. If there is, we should 
     // schedule an initial token refresh for when the 
     // token expires 
     this.auth.startupTokenRefresh(); 

    }); 
} 
: 나는 문제가 Google Play 무비 업체에 app.ts에 생각

0  883034 error Uncaught Invalid provider - only instances of Provider and Type are allowed, got: [object Object], http://localhost:8100/build/js/app.bundle.js, Line: 24470 

}

나를 도와주세요!

+0

같은 문제가 있습니까? :에스 – Eusthace

답변

0

내가 삭제하면이 오류를 가지고, 당신의 package.json을 확인 : 파일 종속성에서

"angular2": "2.0.0-beta.15",

합니다. 도움이 되었으면 좋겠지 만 다른 일이 될 수 있습니다.

1

@App 데코레이터를 사용하고 있습니다.

ionicBootstrap(MyApp, [ 
    provide(AuthHttp, { 
    useFactory: (http) => { 
     return new AuthHttp(new AuthConfig({noJwtError: true}), http); 
    }, 
    deps: [Http] 
    })], 
    { 
    tabbarPlacement: 'bottom' 
    } 
); 

이이 방식으로 작동한다 : 이것은 당신이 최신 버전으로 업데이트하고 그것을 "새로운"방법을 부트 스트랩하시기 바랍니다 이온 2. 이전 베타를 사용하는 것을 의미합니다!