Oauthを使用して.NETアプリケーションからsalesforceに接続しようとしています。私は現時点でDotNetOpenAuthを使用しており、運がない。私はtwitter/googleなどをうまく動作させることができますが、Salesforceの新しいコンシューマーサービスを作成すると、エラー(400/Bad Request)が表示されますSalesforce DotNetOpenAuth/Oauthリモートアクセスの問題
私はInMemoryTokenManagerを使用していますが、 at、twitter et alがこのようにうまく動作することを再確認してください。私はinmemorytokenのマネージャーをデータベースのimplentationに置き換えることを意図していますが、今のところ私はそれを働かせたいだけです。
奇妙なことですが、私は手動でURLを作成する場合 - https://login.salesforce.com/services/oauth2/authorize?response_type=code &のclient_id = [CONSUMER_KEY] & REDIRECT_URI = [REDIRECT_URL]とブラウザに入力してください。私はセールスフォースのページで、アカウントにアクセスする権限をアプリに与えます。
これが期待どおりの動作ですか?それはセキュリティホールのようだが、多分私はすべてを正しく理解していないだろう。
私は間違っていますか?
ConsumerCode - (少なくともも、重要な部分)
public static readonly ServiceProviderDescription ServiceDescription = new ServiceProviderDescription
{
RequestTokenEndpoint =
new MessageReceivingEndpoint(
"https://login.salesforce.com/services/oauth2/authorize",
HttpDeliveryMethods.GetRequest |
HttpDeliveryMethods.AuthorizationHeaderRequest),
UserAuthorizationEndpoint =
new MessageReceivingEndpoint(
"https://login.salesforce.com/services/oauth2/authorize",
HttpDeliveryMethods.GetRequest |
HttpDeliveryMethods.AuthorizationHeaderRequest),
AccessTokenEndpoint =
new MessageReceivingEndpoint(
"https://login.salesforce.com/services/oauth2/token",
HttpDeliveryMethods.GetRequest |
HttpDeliveryMethods.AuthorizationHeaderRequest),
TamperProtectionElements =
new ITamperProtectionChannelBindingElement[] {
new HmacSha1SigningBindingElement() },
};
OAuthController.cs
if (this.SFTokenManager != null)
{
var SF = new WebConsumer(SFConsumer.ServiceDescription, this.SFTokenManager);
// Is Twitter calling back with authorization?
var accessTokenResponse = SF.ProcessUserAuthorization();
if (accessTokenResponse != null)
{
this.SFAccessToken = accessTokenResponse.AccessToken;
}
else if (this.SFAccessToken == null)
{
// If we don't yet have access, immediately request it.
SF.Channel.Send(SF.PrepareRequestUserAuthorization());
}
return View("SFIn");
}
else
{
return View("SFOut");
}
私が手のラインは私である400で
// If we don't yet have access, immediately request it.
SF.Channel.Send(SF.PrepareRequestUserAuthorization());
。 – superfell