I have the following button

<div class="fb-login-button" data-max-rows="1" data-size="large" data-button-type="login_with" data-show-faces="false" data-auto-logout-link="true" data-use-continue-as="false" id="fb-btn" ></div> 

And the JS code that automatically checks if the user logged in to Facebook on every page load and sends me data.

 const $facebookBtn = $('#fb-btn'); $facebookBtn.on('login', this.getDataUserFacebook()); getDataUserFacebook() { FB.login(response => { if (response.status !== 'connected') { console.log(`Not auth, status ${response.status}`); } FB.api('/me?fields=link,id,name,email,birthday,location', (response) => { this.buildProfile(response); }); }); } buildProfile(user) { this.user = { profile_link: user.link, name: user.name, birthday: user.birthday, }; console.log(this.user); } 

I need to never have the user have the opportunity to immediately be logged in via facebook. I just need to click on the "Login via FB" window to access the application, then the object I needed is formed, and then the exit occurs. And now it happens not by a click, but automatically. What am I doing wrong?

  • In all likelihood, you have once confirmed that the facebook application has access to your data, so long as you have a session in the browser, it automatically passes on. Open the browser in incognito and try again. - Arsen
  • @ Arsen thanks for the reply. But that is not the problem. And the fact that I immediately popped up the login window, and not by clicking. Even in incognito mode - Roman Tatarinov
  • Try to delete the first two lines in the code and put the handler itself. When clicked, call the getDataUserFacebook () method - Arsen

0