DotNetOpenAuth を使用してユーザーの認証を行っていますが、機能させることができません。これは私のコードです:
public string AuthenticateUser(
string key, string secret, string user, string password,
AuthorizationServerDescription serviceDescription)
{
UserAgentClient agent = new UserAgentClient(
serviceDescription,
key,
secret);
IAuthorizationState authState = mConsumer.ExchangeUserCredentialForToken(
user,
password,
GetScope());
if (authState != null)
{
return authState.Token;
}
}
GoogleとWindowsLiveに対して認証しようとしていますが、どちらの場合も成功しません。
グーグル
これらは、Google OAuth サービスへのアクセスに使用される構成パラメーターです。
AuthorizationEndpoint = new Uri("https://accounts.google.com/o/oauth2/auth")
TokenEndpoint = new Uri("https://accounts.google.com/o/oauth2/token")
ProtocolVersion = ProtocolVersion.V20
State = "/profile"
Scope = "https://www.googleapis.com/auth/userinfo.email"
取得したエラー:
---------------------------
Error
---------------------------
Error occurred while sending a direct message or getting the response.
---------------------------
OK
---------------------------
Windows ライブ
これらは、Windows Live Outh サービスにアクセスするために使用されるパラメーターです。
TokenEndpoint = new Uri("https://oauth.live.com/token"),
AuthorizationEndpoint = new Uri("https://oauth.live.com/authorize")
ProtocolVersion = ProtocolVersion.V20
State = null
Scope = "wl.signin"
取得したエラー:
---------------------------
Error
---------------------------
Unexpected response Content-Type text/html
---------------------------
OK
---------------------------
ClientCredentialApplicator
また、あらゆる方法でを使用してテストしました。
- ネットワーク資格情報
- ノーシークレット
- PostParameter
私は何か間違ったことをしていますか?誰かが私に実例を見せることができExchangeUserCredentisForToken
ますか?
事前に感謝します。