8000 fixed the front-end steps rollout with the popup method · cethap/sdk-node-tutorial@962e2b0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 962e2b0

Browse files
committed
fixed the front-end steps rollout with the popup method
1 parent cf76d77 commit 962e2b0

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

public/src/script.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ function init_oauthio() {
22
// Add the code to initialize OAuth.io here
33
}
44

5-
65
function retrieve_token(callback) {
76
// Add the code to retrieve the state token here
87
}
@@ -15,19 +14,25 @@ function retrieve_user_info(callback) {
1514
// Add the code to perform a user request here
1615
}
1716

18-
19-
$('#login_button').click(function () {
17+
$('#login_button').click(function() {
2018
init_oauthio();
21-
retrieve_token(function (err, code) {
22-
authenticate(code, function (err) {
23-
if (!err) {
24-
retrieve_user_info(function (user_data) {
25-
$('#name_box').html(user_data.name)
26-
$('#email_box').html(user_data.email);
27-
$('#img_box').attr('src', user_data.avatar);
19+
retrieve_token(function(err, code) {
20+
OAuth.popup('facebook')
21+
.done(function(r) {
22+
authenticate(code, function(err) {
23+
if (!err) {
24+
retrieve_user_info(function(user_data) {
25+
$('#name_box').html(user_data.name)
26+
$('#email_box').html(user_data.email);
27+
$('#img_box').attr('src', user_data.avatar);
28+
});
29+
}
2830
});
29-
}
30-
});
31+
})
32+
.fail(function(e) {
33+
console.log(e);
34+
});
35+
3136
});
32-
33-
});
37+
38+
});

0 commit comments

Comments
 (0)
0