I'm building a webpage Facebook app, I need the app to access a Facebook page and access and display user posts from the page. I have admin control of the Facebook page.
How should I go about achieving this: If I add my Facebook app webpage as a App on my Facebook page will it be able to access the information on the Facebook page?
You will have to grant your application the "manage_pages" permission :
https://www.facebook.com/dialog/oauth? client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=manage_pages&response_type=token
once you have that permission you can make a request for an access token :
https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&
grant_type=client_credentials
With this access token you can make requests to the graph api as your page...
You can read more here on the authentication documentation. Look for "App login" and "Page login"
Related
This is how my login button looks like:
<div
class="fb-login-button"
data-width=""
data-size="large"
data-button-type="continue_with"
data-layout="rounded"
data-scope="pages_show_list"
data-onlogin="fbAuthCb"
data-auto-logout-link="true"
data-use-continue-as="true">
</div>
This is my flow:
Fb.auth (after login) returns a short-lived token that then I exchanged for a 60-day long-lived one.
At that point I try to query Facebook graph for a page token that then I would use to query the Pages API.
fetch(https://graph.facebook.com/${FB_PAGE_ID}?fields=access_token&access_token=${data.access_token})
However, the login dialog, after selecting the page for which I have editor role (and admin in the app on my account), shows the permission pages_show_list requires App View. In theory, I would be able to access such information since I have a role on the page?
Facebook talks about needed the ANALYZE task, but I am not sure what that means. Perhaps I need another role to access information such as analytics and page info?
Other permissions such as pages_read_engagement don't block sign in, but give auth denied when I call for the page token.
I am new to work with wso2.
I am using Facebook or Gmail identity provider to get authenticate using travelocity application.
At First time wso2 redirect to Facebook login page or Gmail login page by which i want to login.
But at second time wso2 do not redirect to Facebook or Gmail login page direct shows home.jsp page with profile information of Facebook or Gmail.
My question is: What should i do if i logout then try to login then wso2 redirect us Facebook or Gmail login page.
This basically happens when you have the previous session stored in the browser and SAML logout has not happened properly.
Have you tried the logout button in the Travelocity app? Where did you find this smaple. Better to build and take the app from here https://github.com/wso2/product-is/tree/master/modules/samples/sso/sso-agent-sample
Futhermore, we do have two more SAML samples if you want to try. You can find them here https://github.com/wso2/samples-is/tree/master/sso-samples/saml2-sso-sample
I am hitting a wall while developing seamless integration of a Facebook page with my bot.
Essentially I want to achieve same integration than Chatfuel or Manychat have, where being logged in with your Facebook account lets you to just choose what page you are connecting to them and you are good to go.
The problem I am facing is generating the proper token in order to bind the selected page to my app (bot). As per Facebook documentation:
When you create a subscribed_apps edge, the page-id you use in endpoint must match the page ID of the page access token used in the API call. The app that the access token is for is installed for the page.
Given the call has no other parameter than the access token, this access token has to be enough for Facebook to:
Authorize the action on the page.
Identify what app is being subscribed to the page.
This is confirmed while using the Facebook Graph API Explorer, where one selects the page and the app to bind and a proper access token is generated:
This token properly works using cURL in the terminal:
$ curl -X POST 'https://graph.facebook.com/v3.0/<MY_APP_ID_HERE>/subscribed_apps?access_token=<TOKEN_PASTED_FROM_GRAPH_API_EXPLORER>'
{"success":true}
With the Facebook Access token debugger (info icon on the left of the access token, then open in Access token tool), it is confirmed that the token knows about both the page and the app that have to be connected.
The question is, how are these page-app related token programmatically produced? I can't seem to find the proper API call in Facebook documentation and it is by all means possible, as Chatfuel and Manychat are doing this.
Thanks in advance for your support Lars Schwarz and community!
Adding some detail to Alex's answer, for it to be more complete.
When subscribing an app to a page, Facebook needs to:
Know what app you are talking about.
Know what page you are talking about.
Know that you have permissions on that page to subscribe an app.
How does Facebook know it all?
1 comes from the fact that Facebook login happens in the context of a page, actually, the Javascript code for Facebook contains your appId:
js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.0&appId=<YOUR_APP_ID_IS_HERE>&autoLogAppEvents=1';
2 Comes from the page_id in the URL used to subscribe apps to pages:
https://graph.facebook.com/v3.0/YOUR_APP_ID_HERE/subscribed_apps?access_token=YOUR_ACCESS_TOKEN_HERE
3 Comes from the access token, obtained in the context of an APP through Facebook login, that is passed as parameter in the URL used to subscribe apps to pages:
https://graph.facebook.com/v3.0/YOUR_APP_ID_HERE/subscribed_apps?access_token=YOUR_ACCESS_TOKEN_HERE
To do this, you need to put FB Login on your site/customer portal and request pages_messaging and manage_pages permissions. The person that logs in must be a Page Admin.
Once your app has been granted that permission for the page, you can generate a page access token as described here:
https://developers.facebook.com/docs/pages/access-tokens
My application use facebook authentication to ask the user permissions to manage his ads. i use the following scope:'public_profile,ads_management,ads_management'
but in the login window it shows only public profile which will an invalid access token for the ads management.
have a look at this answer https://stackoverflow.com/a/25901780/5410373
the ads_management extended permission is only granted to whitelisted apps. So if the Graph endpoint you're hitting requires that permission then you'll have to get your app approved. Check out the getting started overview https://developers.facebook.com/docs/reference/ads-api/overview
and this answer : https://stackoverflow.com/a/24753070/5410373
All permissions except
public_profile
user_friends
email
require a review of your app by Facebook before you can use them publically. See https://developers.facebook.com/docs/apps/review/login#do-you-need-review
I am using SAML SSO to authenticate users coming to my web app. I am using the SAML SSO filter. In the login page of IS(AuthenticationEndpoint/samlsso) can I add a button to visit my web page anonymously without authentication? Who should I do the redirection?
I think you need to add button to login page where you can enter credential to authenticate the user. To get this done you will have to customize authenticationendpoint.war adding new button to the login.jsp page[1] to redirect it to your page.
[1] https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/identity/org.wso2.carbon.identity.application.authentication.endpoint/4.2.2/src/main/webapp/