【问题标题】:How to use DotNetOpenAuth.OAuth.DesktopConsumer.RequestUserAuthorization with url contaqins port?如何将 DotNetOpenAuth.OAuth.DesktopConsumer.RequestUserAuthorization 与 url contaqins 端口一起使用?
【发布时间】:2014-06-07 20:23:45
【问题描述】:

我有:

            var service = new ServiceProviderDescription
            {
                RequestTokenEndpoint = new MessageReceivingEndpoint( this._requestTokenUrl, this._requestTokenHttpDeliveryMethod ),
                UserAuthorizationEndpoint = new MessageReceivingEndpoint( this._authorizeUrl, HttpDeliveryMethods.GetRequest ),
                AccessTokenEndpoint = new MessageReceivingEndpoint( this._accessTokenUrl, this._accessTokenHttpDeliveryMethod ),
                TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() },
                ProtocolVersion = ProtocolVersion.V10a, 
            };

            this._tokenManager = new InMemoryTokenManager();
            this._tokenManager.ConsumerKey = this._consumerKey;
            this._tokenManager.ConsumerSecret = this._consumerSecretKey;

            this._consumer = new DesktopConsumer( service, this._tokenManager );

            this._accessToken = string.Empty;
                            consumer.RequestUserAuthorization( null, null, out this.requestToken );

当 _requestTokenUrl 等于例如 127.0.0.1:1234/magento - 方法抛出异常,因为服务器返回:401 oauth_problem=signature_invalid

但如果我使用 127.0.0.1/magento,它可以正常工作。

如何将 RequestUserAuthorization() 与包含端口的 URL 一起使用?

【问题讨论】:

    标签: magento url port dotnetopenauth magento-1.8


    【解决方案1】:

    我不是在 DotNetOpanAuth 中而是在 magento 中找到了解决方案。默认情况下,magento 在计算Mage_Oauth_Model_Server::_validateSignature() 中的签名时会忽略端口。要更改它,您必须将 false 参数传递给 $this->_request->getHttpHost()。 或许有可能Magento Rest Oauth API (Signature Invalid) 401

    【讨论】:

      猜你喜欢
      • 2016-08-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-05
      • 1970-01-01
      • 2019-06-06
      相关资源
      最近更新 更多