Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8217395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:27:14+00:00 2026-06-07T12:27:14+00:00

How do I like a Facebook business page once the user has logged in

  • 0

How do I like a Facebook business page once the user has logged in and authorized my app to Publish on his/her behalf? Here’s my code so far:

window.fbAsyncInit = function() {
    FB.init({ appId: 'MY_APP_ID',                    
        status: true, 
        cookie: true,
        xfbml: true,
        oauth: true});

        document.getElementById('fb-auth').addEventListener('click', function() {
          FB.login(function(response){
            if(response.authResponse){ // user has authorized app
                FB.api('/me/likes/BUS_PAGE_ID', function(response){
                    if(response.data.length>0) {
                       // user has liked the page
                    } else {
                       // like the page for the user                                  
                    }
                });
            }
          }, {scope:'publish_actions, user_likes'});
        }, false);
};

The code is working to the point that it authorizes the app and I can see if the business page is liked by the user with FB.api(…) if(response.data.length>0). What do I put in the place of // like the page for the user so that my app can like a specific business page and add it to the user’s likes? Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T12:27:16+00:00Added an answer on June 7, 2026 at 12:27 pm

    Actions can only be used for objects outside of Facebook.

    You cannot use the built-in like action and you definitely cannot force a user to like a Facebook page.

    Use the Like box or redirect the user to your Facebook page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm think something like Facebook apps here. User generated pieces of code that people
So it looks like Facebook has removed the page referencing how to resize iframe
You know how facebook has those urls like facebook.com/example that goes to the page
How can I set up a business facebook page that when a user enters
I have just created a facebook business page and currently thus have no likes
I have created topbar like Facebook app now I'm stuck I want to create
How to detect anonymous user like facebook does, when you open it throught proxy
We have out business profile page as http://facebook.com/geoflakes , and i can get its
I am fetching url like facebook. For all images in that page I get
It seems like facebook has this mastered, I've checked a bit into WURFL but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.