Skip to content
This repository has been archived by the owner on Oct 16, 2019. It is now read-only.

Commit

Permalink
use loginWithCredentials
Browse files Browse the repository at this point in the history
  • Loading branch information
chenkie committed Mar 18, 2017
1 parent 2e7a27e commit af962fa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion 02-Custom-Login/auth0-variables.js.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var AUTH0_CLIENT_ID='{CLIENT_ID}';
var AUTH0_DOMAIN='{DOMAIN}';
var AUTH0_CALLBACK_URL='{CALLBACK_URL}';
var AUTH0_CALLBACK_URL=window.location.href;
2 changes: 1 addition & 1 deletion 02-Custom-Login/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"angular-jwt": "^0.1.9",
"angular-ui-router": "~0.3.1",
"bootstrap": "~3.3.7",
"auth0.js": "^8.3.0"
"auth0.js": "^8.4.0"
},
"resolutions": {
"angular": "1.5.8"
Expand Down
14 changes: 6 additions & 8 deletions 02-Custom-Login/components/auth/auth.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@
function authService($state, angularAuth0, authManager) {

function login(username, password) {
angularAuth0.client.login({
realm: 'Username-Password-Authentication',
angularAuth0.redirect.loginWithCredentials({
connection: 'Username-Password-Authentication',
username: username,
password: password,
}, function(err, authResult) {
if (err) alert(err.description);
if (authResult && authResult.idToken) {
setUser(authResult);
$state.go('home');
}
}, function(err) {
if (err) return alert(err.description);
});
}

Expand All @@ -29,6 +25,8 @@
connection: 'Username-Password-Authentication',
email: username,
password: password
}, function(err) {
if (err) return alert(err.description);
});
}

Expand Down

0 comments on commit af962fa

Please sign in to comment.