3

I have the following code:

FB.getLoginStatus(function (response) { if (response.session) { } else { FB.ui({ method: 'oauth', perms: 'email,publish_stream', }, function (response) { if (response && response.installed) { window.location.reload(); } }); } }); 

What I want is to basically redirect the user to the same page so that the serverside can use the REST API. Is there anyway to make this work?

2 Answers 2

5

Subscribe to the login event:

FB.Event.subscribe('auth.login', function (response) { window.location.reload(); }); 
Sign up to request clarification or add additional context in comments.

Comments

1

Use this.

FB.Event.subscribe('auth.sessionChange', function (response) { if (response.session) { //user is logged in! window.location = document.URL; } }); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.