2016-11-06 4 views
1

私は、thisガイドに従って自分のログインアプリを自分のローカルアプリでローカルに動作させようとしています。私が苦労している部分は、私のログインコールバックが呼び出されないということです。auth0カスタムログイン画面のコールバックURLを把握しようとしています

私のオリジナルのログインURLは、私は、なぜ私はこのURLにリダイレクトされますかhttp://localhost:9000/#/access_token<myaccesstoken>&id_token=<myIdToken>&token_type=Bearer

にリダイレクトし、私のコールバックは決して呼ばれることはありません飽き、

angular.module('myApp').service('authService', function ($location, angularAuth0) { 

    function login(username, password, callback) { 
     console.log('in login service'); 
    angularAuth0.login({ 
     connection: 'Username-Password-Authentication', 
     responseType: 'token', 
     email: username, 
     password: password 
    }, function(err) { 
     console.log('we NEVER get here'); 
    }); 
    } 

    return { 
     login: login 
    }; 

}); 


angular.module('myApp').controller('LoginCtrl', function ($scope, $location, authService) { 

    $scope.login = function() { 
     ... 
     authService.login($scope.user.email, $scope.user.password) 

私がログインhttp://localhost:9000/#/loginのですか?

また、ガイドで作成するauthenticateAndGetProfile()というこの機能を使用する場合は、

Register the authenticateAndGetProfile in app.run.js so that authentication results get processed after login. 

// app.run.js 

(function() { 

    'use strict'; 

    angular 
    .module('app') 
    .run(function (authService) { 

    // Process the auth token if it exists and fetch the profile 
    authService.authenticateAndGetProfile(); 
    }); 

})(); 

欠けていたと今ではすべてが動作します。[OK]を

+0

auth0.service.jsは次のようなものですか:https://github.com/auth0-samples/auth0-angularjs-sample/blob/master/02-Custom-Login/components/auth/auth.service。 js? https://github.com/auth0-samples/auth0-angularjs-sample/tree/master/02-Custom-Loginにはサンプルがありますが、それはあなたのために機能しますか? –

+0

はい、authServiceのログイン機能が同じであることがわかります。私はサンプルをクローンして実行しようとしていません。私が気づく一つのことは、 'authenticateAndGetProfile'メソッドがどこからでも呼び出されないということです。 – Catfish

答えて

2

はAuth0サポートチームと協力して、彼らのドキュメントが以降に追加されました。このセクションに欠けていたようです。

関連する問題