1
我一直在試圖遵循this指南讓我的自定義登錄屏幕與我的角度應用程序在本地一起工作。我正在努力的部分是我的登錄回調永遠不會被調用。試圖找出auth0自定義登錄屏幕回調url
我原來的登錄URL是http://localhost:9000/#/login
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/#/access_token<myaccesstoken>&id_token=<myIdToken>&token_type=Bearer
爲何我會被重定向到這個網址和我的回調永遠不會叫什麼名字?
另外,當我應該使用這個功能authenticateAndGetProfile()
他們在指南中創建?
你的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你有一個工作樣本,它是否適合你? –
是的,你可以在authService中看到我的登錄功能是一樣的。我還沒有試過克隆這個樣本並運行它。我注意到的一件事是'authenticateAndGetProfile'方法永遠不會從任何地方被調用。 – Catfish