2012-05-12 13 views
2

Facebook C# SDK를 사용하여 상태 업데이트를 게시하려고 할 때 다음 오류가 발생합니다. OAuthException : (# 200) 사용자가이 작업을 수행하도록 응용 프로그램을 승인하지 않았습니다.OAuthException : (# 200) 사용자가이 작업을 수행하도록 응용 프로그램을 승인하지 않았습니다.

일부 사용자 만이 오류가 발생합니다. 다른 경우에는 상태가 정상적으로 업데이트됩니다. 앱이 모든 사용자에게 성공적으로 액세스하고 있습니다.

이 전체 코드입니다 :

public partial class Authorize : Form 
    { 
     public Authorize() 
     { 
      InitializeComponent(); 

     } 

     public string ApplicationId 
     { 
      get 
      { 
       return ConfigurationManager.AppSettings["ApplicationId"]; 
      } 
     } 

     public string ExtendedPermissions 
     { 
      get 
      { 
       return ConfigurationManager.AppSettings["ExtendedPermissions"]; 
      } 
     } 

     public string AppSecret 
     { 
      get 
      { 
       return ConfigurationManager.AppSettings["ApplicationSecret"]; 
      } 
     } 

     public string AccessToken { get; set; } 

     private void LoadAuthorize(object sender, EventArgs e) 
     { 
      var destinationURL = String.Format(
       @"https://www.facebook.com/dialog/oauth?client_id={0}&scope={1}&redirect_uri=http://www.facebook.com/connect/login_success.html&response_type=token", 
       this.ApplicationId, 
       this.ExtendedPermissions); 
      webBrowser.Navigated += WebBrowserNavigated; 
      webBrowser.Navigate(destinationURL); 
     } 

     private void WebBrowserNavigated(object sender, WebBrowserNavigatedEventArgs e) 
     { 
      // get token 
      var url = e.Url.Fragment; 
      if (url.Contains("access_token") && url.Contains("#")) 
      { 
       this.Hide(); 
       url = (new Regex("#")).Replace(url, "?", 1); 
       this.AccessToken = System.Web.HttpUtility.ParseQueryString(url).Get("access_token"); 
       //MessageBox.Show(facebookCore.AccessToken); 
       try 
       { 
        //var facebooking = new FacebookingTest(facebookCore.AccessToken); 
        //facebooking.UpdateStatus(); 
        var fb = new FacebookClient(this.AccessToken); 
        dynamic result = fb.Post("me/feed", new { message = "Hi..Test33" }); 
        var newPostId = result.id; 
       } 
       catch (Exception exception) 
       { 
        Console.Write(exception); 
       } 
      } 

     } 
    } 
+0

은을 시도 Prabhir의 코드는 http://blog.prabir.me/post/Facebook-CSharp-SDK-Writing-your-First-Facebook-Application-v6.aspx .. same issue – harry

+0

액세스 토큰에 'publish_stream'또는 'publish_actions'권한이 있는지 반드시 확인 하시겠습니까? 이전은 사용자가 거부하거나 취소 할 수있는 선택적 권한입니다. – Igy

답변

2

파일의 app.config를 열고 시도하고 다음과 같이

<appsettings> 

섹션의 마지막 줄을 수정

<add key="ExtendedPermissions" value="offline_access,publish_stream,publish_actions" /> 
+1

App.Config를 열고 섹션의 마지막 줄을 다음과 같이 수정하십시오.

관련 문제