2017-10-02 13 views
0

auth0を使用して私のangular2アプリケーションのログインを作成しようとしています。auth0-jsにエラーが見つかりませんAngular2

私は下のリンクを以下のい: - :

  • NPMがインストールauth0.jsをインストール

    1. を設定するコールバックURLを
    2. を - -

      https://auth0.com/docs/quickstart/spa/angular2

      を私は、次の手順にしました-save auth0-js

    3. Auth0のCDNからauth0.jsを取得します。

    サービスの下に追加されました: -

    // src/app/auth/auth.service.ts 
     
    
     
    import { Injectable } from '@angular/core'; 
     
    import { Router } from '@angular/router'; 
     
    import 'rxjs/add/operator/filter'; 
     
    import * as Auth0 from 'auth0-js'; 
     
    
     
    //const Auth0 = require('auth0-js'); 
     
    
     
    //import * as auth0 from './../../../node_modules/auth0-js/build/auth0.js'; 
     
    
     
    @Injectable() 
     
    export class AuthService { 
     
    
     
        auth0 = new Auth0.WebAuth({ 
     
        clientID: 'test', 
     
        domain: 'www.test.com', 
     
        responseType: 'token id_token', 
     
        audience: 'personaluserinfo', 
     
        redirectUri: 'http://localhost:3000/home',  
     
        scope: 'openid' 
     
        }); 
     
    
     
        constructor(public router: Router) {} 
     
    
     
        public login(): void { 
     
        this.auth0.authorize(); 
     
        } 
     
    
     
    }

    しかし、以下のように、私はエラーを取得しています: -

    zone.js:http://localhost:3000/auth0-js 404(2933見つかりませんGET )

    家:23エラー:(SystemJS)XHRエラー(404が見つかりません)ロードhttp://localhost:3000/auth0-js

    以下、これらのページへの答えは私にはそれほど有用ではありませんでした: -

    How configure SystemJS with Auth0?

    Angular 2 + Auth0 (Could not find a declaration file for module 'auth0-js'.)

    どんな助けもありがとう。

  • 答えて

    1

    最初のステップとして、instructions here for installing auth0.js when using Angular 2を再確認してください。これは非常に一般的なクイックスタートなので、正確でなければなりません。問題が引き続き発生する場合は、以下のコメントを残してください。クイックスタートをインストールしてすべてを確認します。

    関連する問題