File tree Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ function init_oauthio() {
2
2
// Add the code to initialize OAuth.io here
3
3
}
4
4
5
-
6
5
function retrieve_token ( callback ) {
7
6
// Add the code to retrieve the state token here
8
7
}
@@ -15,19 +14,25 @@ function retrieve_user_info(callback) {
15
14
// Add the code to perform a user request here
16
15
}
17
16
18
-
19
- $ ( '#login_button' ) . click ( function ( ) {
17
+ $ ( '#login_button' ) . click ( function ( ) {
20
18
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
+ }
28
30
} ) ;
29
- }
30
- } ) ;
31
+ } )
32
+ . fail ( function ( e ) {
33
+ console . log ( e ) ;
34
+ } ) ;
35
+
31
36
} ) ;
32
-
33
- } ) ;
37
+
38
+ } ) ;
You can’t perform that action at this time.
0 commit comments