У меня 2 заявки.Одним из них является приложение Rails, другим - веб-сайт WordPress.Моя цель - соединиться с 2app через WP REST API.Этот API должен использовать OAuth.Предполагается, что версия 1.0a.Для этого я настроил гем oauth-xx / oauth-ruby.Ниже мой код.Независимо от того, сколько я настроил, мне все равно не удалось.Сообщение выглядит как «Параметры OAuth не указаны».
@consumer = OAuth::Consumer.new(
'Client Key',
'Client Secret',
{:site => 'http://our-wordpresssite.com',
:request_token_path => '/oauth1/request',
:access_token_path => '/oauth1/authorize',
:authorize_path => '/oauth1/access',
:debug_output => true})
@request_token = @consumer.get_request_token
session[:token] = request_token.token
session[:token_secret] = request_token.secret
redirect_to @request_token.authorize_url(:oauth_callback => @callback_url)
Вот журнал отладки.
opening connection to dev-style.vegewel.com:80...
opened
<- "POST /oauth1/request HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: OAuth gem v0.5.4\r\nContent-Length: 0\r\nAuthorization: OAuth oauth_callback=\"oob\", oauth_consumer_key=\"vS1LY0Gvouif\", oauth_nonce=\"xxxxx\", oauth_signature=\"2%xxxxx%2BjphX1CCY4%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1540327228\", oauth_version=\"1.0\"\r\nConnection: close\r\nHost: dev-style.vegewel.com\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n"
<- ""
-> "HTTP/1.1 400 Bad Request\r\n"
-> "Server: nginx\r\n"
-> "Date: Tue, 23 Oct 2018 20:40:30 GMT\r\n"
-> "Content-Type: text/html; charset=UTF-8\r\n"
-> "Content-Length: 28\r\n"
-> "Connection: close\r\n"
-> "X-Powered-By: PHP/5.6.38\r\n"
-> "X-UA-Compatible: IE=edge\r\n"
-> "Access-Control-Allow-Headers: Authorization\r\n"
-> "Set-Cookie: pll_language=en; expires=Wed, 23-Oct-2019 20:40:30 GMT; Max-Age=31536000; path=/\r\n"
-> "\r\n"
reading 28 bytes...
-> "No OAuth parameters supplied"
read 28 bytes
Conn close
Completed 500 Internal Server Error in 2626ms (ActiveRecord: 27.3ms)
400 Bad Request excluded from capture: Not configured to send/capture in environment 'development'
OAuth::Unauthorized (400 Bad Request):
app/controllers/style/posts_controller.rb:17:in `index'
Это Wordpress WP REST API - настройки сервера OAuth 1.0a.![enter image description here](https://i.stack.imgur.com/FU7xR.png)
Кто-нибудь знает, как мне поступить?Заранее спасибо.