0
내 MVC
애플 리케이션에서 페이스 북의 벽에 사진, 비디오를 게시해야합니다. 오류가 발생했습니다. (OAuthException - #2500) An active access token must be used to query information about the current user.
페이스 북에 사진과 비디오를 게시하십시오.
도와주세요. 아래 코드를 사용하고 있습니다.
required AcccountId, pageid
dynamic parameters = new ExpandoObject();
parameters.message =modelList.message;
parameters.subject = modelList.subject;
parameters.account_id = modelList.AcccountId;
imageBytes = byte[] of image
parameters.source = new FacebookMediaObject{
ContentType = imageType,
FileName = Url
}.SetValue(imageBytes);
client.Post(pageid+ "/photos", parameters);
은 도움이 될 것입니다 희망 :
string appID = string.Empty;
string appSecretCode = string.Empty;
appID = "<<application Id>>";
appSecretCode = "<<app secretcode>>";
var fb = new FacebookClient();
dynamic result = fb.Get("oauth/access_token", new
{
client_id = appID,
client_secret = appSecretCode,
grant_type = "client_credentials",
scope = "publish_stream"
});
string accessToken = result.access_token;
var client = new FacebookClient(accessToken);
var postparameters = new Dictionary<string, object>();
var media = new FacebookMediaObject
{
FileName = @"Bday.jpg",
ContentType = "image/jpeg"
};
byte[] img = System.IO.File.ReadAllBytes(@"C:\Users\user\Desktop\Bday.jpg");
media.SetValue(img);
postparameters["source"] = media;
postparameters["access_token"] = result.access_token;
var result1 = client.Post(String.Format("https://graph.facebook.com/{0}/photos", "<<User ID>>"), postparameters);
@Junaith 여전히 내 문제가 해결되지 않았습니다. 어떤 옵션이 있다면이 질문을 홍보하도록 도와주세요. – user2537735
Heyla, 어떻게 이런 일을 할 수 있었습니까? –
이 문제는 해결되었습니다. postparameters [ "access_token"] 프라퍼티에 대해 그래프 API 탐색기에 채워지는 액세스 토큰을 지정해야합니다. – user2537735