私は、購入した製品を自分のウェブサイトに共有する機能をに追加しようとしています。これを行うには、Facebookでユーザーを認証し、必要な権限を取得する必要があります。Facebook認証リダイレクトループ
私はあなたが認証されているかどうかをチェックするコードを持っています。そうでなければ、認証するためにFacebookのoAuthページにリダイレクトします。しかし
、それはリダイレクトループに入るのページに戻りFacebookのから、:
var auth = new FacebookWebAuthorizer();
bool authorized = auth.FacebookWebRequest.IsAuthorized(new string[] { "publish_stream" });
if (authorized)
{
var client = new FacebookClient(auth.FacebookWebRequest.AccessToken);
Dictionary<string, object> args = new Dictionary<string, object>();
args["message"] = "This is a test.";
args["name"] = "";
args["link"] = "http://www.example.com/";
args["description"] = "Test link.";
client.Post("/me/feed", args);
}
else
{
var facebookClient = new FacebookOAuthClient();
var parameters = new Dictionary<string, object> {
{ "redirect_uri", "http://www.example.com/" },
{ "client_id", "xxxx" },
{ "scope", "publish_stream" }
};
Response.Redirect(facebookClient.GetLoginUrl(parameters).ToString(), true);
}
私のweb.configファイルには、次のようになります。
<configuration>
<configSections>
<section name="facebookSettings" type="Facebook.FacebookConfigurationSection" />
</configSections>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<add name="facebookredirect.axd" verb="*" path="facebookredirect.axd" type="Facebook.Web.FacebookAppRedirectHttpHandler, Facebook.Web" />
</handlers>
</system.webServer>
<facebookSettings appId="xxxx" appSecret="xxxx" />
</configuration>
私のサイトではないように見えます私はすでに認証されていることを認識しているので、Facebookのログインにリダイレクトされます。 Facebookはそれから私が認証されていることを知っているので、私をリダイレクトしてループを引き起こします。
あなたが提供したリンクは解決策を提示していません。 –