Codeigniter, Facebook javascript SDK, PHP SDK Redirect after facebook login doesn't getUser() until refresh

前端 未结 1 1468
忘了有多久
忘了有多久 2020-12-15 13:21

The process is as follows.

1. User clicks Facebook Login button
2. User signs in and grants perms
3. Facebook redirects uses FB.Event.subscribe auth.login to         


        
1条回答
  •  青春惊慌失措
    2020-12-15 13:56

    Well I seem to have figured this out. I made this change to the javascript:

        FB.Event.subscribe('auth.login', function(response) {
        FB.api('/me', function(response) {
        window.location.reload();
        });
    });
    

    I guess that by adding the FB.api('/me', function(response){}); it somehow made the getUser() return true. If anyone else is having getUser() return 0 try this. Anyway I hope this helps others :)

    0 讨论(0)
提交回复
热议问题