1

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;
    }
}

GoogleWindowsLiveに対して認証しようとしていますが、どちらの場合も成功しません。

グーグル

これらは、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ますか?

事前に感謝します。

4

1 に答える 1

1

リソース所有者の資格情報の付与は、認可サーバーによって許可されている場合にのみ機能します。Google と Microsoft は、サードパーティのアプリがユーザー資格情報を直接取得することを望まないため、意図的にこれをサポートしていないと思います。

于 2013-03-09T18:46:33.340 に答える