Getting facebook incoming feeds, issue with access token - c#

I m trying to fetch feeds by graph API using
https://graph.facebook.com/me/feeds?access_token=xxxxx
I tried with steps for getting short live access token,then using short live access token able to get long live access token
using long live access token i tried to fetch feeds but no data found
so using long live access token ,i tried following code for getting page access token
https://graph.facebook.com/me/accounts?access_token=LongLivedToken
but it i always found blank page access token.
please suggest which token should i pass for getting incoming feed using graph api

I think the problem is with the permission given to the access_token
to get the facebook feed , u need a read_stream permission from facebook, ie a access token with read_stream.

Related

how to generate bridgedataoutput api access token

i register on https://bridgedataoutput.com/ for using bridge data api. as per documents
https://bridgedataoutput.com/docs/platform/API/zg-data#Zestimates
require access token. how I get access token ?
after login , I get detail of Client id, Client Secret and Server Token. i try server token but give me authorization error.
I try to do get request on this below API link
https://api.bridgedataoutput.com/api/v2/zestimates_v2/zestimates?access_token=P7cbhWXt2PLOGOHbctzuOJ1qF2mJYSSF7cI1IrUabGdt3u2IGMiFzu5XLCNk&address=%22123%20Main%20Street%22
Response
{"success":false,"status":403,"bundle":{"name":"AuthenticationError","message":"Invalid access_token format"}}
I had the same issue, and Bridge support said to use the Server Token as the access token. It needs to go in the URL, not as a header when I tried it. Here's an example.
https://api.bridgedataoutput.com/api/v2/OData/[DATASET_ID]/[RESOURCE]?access_token=[SERVER_TOKEN]
Zillow Public Records, Zestimates and Econimic Data does need additional approval. Please confirm in https://bridgedataoutput.com/data/feeds.

twitter get user profile data

I want to get the user profile data on connect to twitter. I managed to connect and get the access token and access token secret using Tweetsharp Lib. But trying to get the user profile throw an error.
So I want to use the Rest Api and just get the info my self.
I would like to see an example of how to pass the access token and or access token secret. Anybody can help me out please?
I am the developer of Tweetinvi which is a library similar to Tweetsharp but that is maintained and up to date.
You can get a user profile using the following code :
TwitterCredentials.SetCredentials("Access_Token", "Access_Token_Secret", "Consumer_Key", "Consumer_Secret");
var user = User.GetUserFromScreenName("<username>");
I hope this can help you with your code.
Cheers,
Linvi

How to get Page Access Token by code?

I need to generate a Page Access Token for a webpage that I have, this token will be used by the webpage to post to its Facebook Page feed.
This is what I do :
Go to Graph API Explorer
Choose my app from the dropdown
Click Get Access Token
Choose correct permissions(manage_pages/user_events)
To get the Page Access Token I have to run me/accounts in the Graph API Explorer. This will show all the pages I got with a new Page Access Token (short lived(about 60 min)) to each one.
This Page Access Token will work just fine to use in my C# code to post to the feed.
Problem
When another user uses my webpage to post a post I need to generate a new Page Access Token(in code) and then use it to post the userpost to the site´s facebook feed. The problem is that I could clearly not be there to grant the post so how do I handle this?
I could obviously not run the me/accounts(in code) command to get the Page Access Token from here.
I have looked at extended Access Token but this will last 60 days and then it will be the same problem as above.
What you need is an Extended Page Token:
generate User Access Token with manage_pages and publish_actions
generate Extended User Token (valid for 60 days): https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id=[app-id]&client_secret=[app-secret]&fb_exchange_token=[short-lived-token]
call /me/accounts with the Extended User Token to get Extended Page Tokens
Extended Page Tokens are valid forever, so you don´t need to generate a new one all the time.
Source (including information about all the Tokens): http://www.devils-heaven.com/facebook-access-tokens/
On https://developers.facebook.com/docs/pages/access-tokens
Getting Page Access Tokens
GET /{page-id}?fields=access_token&access_token={user_access_token}
The response will look like this:
{
"access_token": "{your-page-access-token}",
"id": "{page-id}"
}

Get current exchange token

I am having difficulty acquiring my current FaceBook exchange token.
Currently I can get a short term access token by using -
String OAuthURl = "https://graph.facebook.com/oauth/access_token?client_id={MY-CLIENT-ID}&client_secret={MY-CLIENT-SECRET}&grant_type=client_credentials";
Which brings back a response like -
123456789|ABCDEFGH
I am trying to generate a new long term access token by building the following URL-
String OAuthURl = "https://graph.facebook.com/oauth/access_token?client_id={MY-CLIENT-ID}&client_secret={MY-CLIENT-SECRET}&grant_type=fb_exchange_token";
This brings back the response-
fb_exchange_token parameter not specified
So I tried -
String OAuthURl = "https://graph.facebook.com/oauth/access_token?client_id={MY-CLIENT-ID}&client_secret={MY-CLIENT-SECRET}&grant_type=fb_exchange_token&fb_exchange_token=123456789|ABCDEFGH
However this is an invalid exchange token.
I believe the first URL I am trying is bringing back a client_credentials however how can I request my fb_exchange_token from a URL without having to manually go into my APP console?
The first URL is requesting an application access token. Application access tokens can be used to modify application settings and perform some operations with users who have authorized your app. Application access tokens do not expire (unless you reset your app secret), and you do not need to exchange them for longer term tokens.

Get authorization code from refreshtoken

I am using dotnetopenauth and working with google api. My problem is to get authorization code from my saved refresh token. If i can get that code then i can get accesstoken. i want to get that code not accesstoken directly. I was unable to find any method or url of end point which can return me authorization code from my refresh token. Thanx in advance
I think you have the OAuth 2 flow confused. Authorization codes do not come from refresh tokens. It's the other way around: you get refresh tokens in exchange for a one-time-use of your authorization code. Access tokens are obtained in any of three ways
In exchange for a refresh token.
In the initial exchange for the authorization code that returns both a refresh token and an access token.
OR, if you're using the implicit grant type instead of the authorization code flow, you get the access token in the url #fragment in response to the user's authorization redirect, but this only applies to JavaScript executing on the browser since fragments are not sent to web servers.

Categories