This endpoint requires the 'manage_pages' permission or the 'Page Public Content Access' feature" - facebook-php-sdk

I am using facebook's business onboarding API for my clients to create Facebook ads. The Facebook marketing API version is v4.0 and we are using "PHP facebook graph SDK" for all the API calls. My application flow for creating a Facebook campaign is as follows:
1)Create a Child Business Manager for a client Facebook account
2)Set Up Payment Method
3)Get the Child System User Token
4)Fetch the System User's ID 5)Get the Funding Source ID
6)Create a New Ad Account with the Default Funding Source 7)Add
the System User as an Admin to the New Ad Account 8)Claim a page
for business as an AGENCY,[Document link]
(https://developers.facebook.com/docs/marketing-api/business-manager/asset-management#pages-claim)
9)Assign system to the page,[Document link](
https://developers.facebook.com/docs/marketing-api/business-manager/asset-management#pages-add-people)
Before assigning a system user to the page I am calling GET API
<https://graph.facebook.com/v4.0/{PAGE_ID}/assigned_users?business={business_id}> for reading specific permission for the Facebook page But this API call results in error "(#10) This endpoint requires the 'manage_pages' permission or the 'Page Public Content Access' feature. Refer to https://developers.facebook.com/docs/apps/review/login-permissions#manage-pages and https://developers.facebook.com/docs/apps/review/feature#reference-PAGES_ACCESS for details."
I am using system user access token for this API and I have already provided manage_pages permission for tokens. What is the reason for this error? Do I need 'Page Public Content Access' permission as well?

Related

Analytics Google API Error 403: “User does not have any Google Analytics Account”

Hi generated secret file using OAuth 2.0 client ID. In that secret file, I do not see any google mail address to authenticate or access permissions to that mail address. Still facing below error.
Arg, there was an API error : 403 : User does not have sufficient permissions for this profile.
How come I know, to which user, we do not have sufficient previliges?
Please help me with this
You have created an Oauth2 client for use with your application. When the application runs a user will need to login using their Google account and grant the application (client) access to their data. I have an article that explains how google oauth2 works if you are interested. Oauth2 for beginners
User does not have sufficient permissions for this profile.
Means that the user you have authenticated with does not have access to the Google Analytics profile you are trying to request data form. Try doing an Accountsummires.list this will return a list of the Google Analytics accounts that the current authenticated user has access to and the ones you will be able to request data from.
Question: How come I know, to which user, we do not have sufficient privileges?
You have a profile id you are trying to access find someone who has access to that profile and have them run your application. When they have logged in and authenticated they will be able to see the data.

Can't Access LinkedIn Company Stats via API

when trying to get this endpoint : https://api.linkedin.com/v1/companies/{id}/company-statistics
we are getting the following error:
"Member 87483729 does not have permission to get company 123928234", status: 403..."
Their docs say :
"All calls to Companies API endpoints will require the authenticated user to be flagged as an administrator of the LinkedIn Company Page that is the target of the API call. You become the administrator of a page when you create it. If the page already exists, you will have to contact the existing administrator to grant admin access to other LinkedIn members."
Funny thing is, we do have admin rights to the page.
We figured it out :
"I had to add permissions to the app, but as i was already logged in
and the auth was done by the cookie..i coudn't see the changes"

Getting 403 while accessing https://api.linkedin.com/v1/companies/

Equinix uses http://api.linkedin.com/v1/companies/ for getting information about any company and we publish this info in our Equinix Marketplace website for that Company's storefront.
We are using Spring Social Network API to connect to LinkedIn API. It was working before and it started giving below error now:
###[WARN] 2015-07-02 00:17:17:839 [org.springframework.web.client.RestTemplate] - GET request for "https://api.linkedin.com/v1/companies/universal-name=tata-communication:(id,name,universal-name,email-domains,company-type,ticker,website-url,industry,status,logo-url,square-logo-url,blog-rss-url,twitter-id,employee-count-range,specialties,locations,description,stock-exchange,founded-year,end-year,num-followers)?" resulted in 403 (Forbidden); invoking error handler ###[ERROR] 2015-07-02 00:17:18:037 [com.equinix.gse.gsd.servlet.SocialNetworkFlowHandlerServlet] - SocialNetworkServiceException
Is there anyway to get any company information via API for any user?
Starting from May 12, 2015, Linkedin has limited the open APIs.
Access to Companies API requires that you apply for and are granted access to this information from LinkedIn.
As per LinkedIn,
All calls to Companies API endpoints will require the authenticated
user to be flagged as an administrator of the LinkedIn Company Page
that is the target of the API call. You become the administrator of a
page when you create it. If the page already exists, you will have to
contact the existing administrator to grant admin access to other
LinkedIn members.
Your API call will return a 403 Forbidden error if you do not have the
appropriate admin permission to interact with the target company.
So from now onwards, you will have to become an administrator for that company page to access the Companies API.
(This LinkedIn page might be helpful to know more about getting the appropriate admin permissions.)

How do enable access to Google Analytics API for an Installed Application?

I am writing a small program to retrieve and display Google Analytics information. I keep getting a 403 Forbidden error because of insufficient permissions.
I read on other posts that you have to add the email address associated with the client id you are using to access analytics in User Management.
The client id I am using however is associated with an installed application and doesn't have an email address, it only lists a client id, client secret, and redirect Urls as credentials in the developer's console.
How can I allow access for this client id when there is no associated email address listed in the developer's console to grant permissions to on the User Management page in Google Analytics?
Simply follow Google's OAuth 2.0 guide for installed applications.
Create a URL for authorization like you would for a web app. Only set redirect_uri to urn:ietf:wg:oauth:2.0:oob.
Point your user to this URL and let him authorize your app. Then the user will receive a code.
Prompt the user to enter this code in your app and use it to retrieve a refresh token from Google.
Store the refresh token and use it to get a fresh access token whenever you need one.

ASP.net + Login with facebook and aspnetdb authorisation

I am using the Facebook login api in my website, currently I am checking if the FB userid exist in my SQL Server database, if it does, the user is allowed to access my website else he will be directed to the Facebook registration plugin page.
The thing is I am also using aspnetdb which in my web.config authorisation, I block all users accept for users who are logged in and authenticated by the aspnetdb membership provider, hence my problem is for users who uses logs in successfully with Facebook gets block by my app's non-fb login page. How should I go about authenticating users who logs in via Facebook? Thanks.
Facebook login/registration API provides you with the FBUserid, it should be stored in your SQL server DB against the user. If a new user comes to your website and registers via FB, you should generate corresponding user in your database too with some default password (random and different for each user) You can provide the functionality that, if a user registered with FB wishes to user your application's login, you should send him the default password via email and ask him/her to change on first login.

Resources