레일 응용 프로그램과 동일한 서버에있는 magento와 통신해야하는 레일 응용 프로그램이 있습니다. 나는 SOAP로 모든 의사 소통을 만들었지 만 그것은 정말로 느리고 모든 것을 REST로 바꾸고 싶다.rails - magento api의 토큰 요청 REST
저는 토큰을 요청하기 위해 magento에 보낼 consumer key
과 consumer secret
입니다.
DOCS : oauth github는 magento oauth
@consumer = OAuth::Consumer.new("44a41ac2e67b", "89578e79570738d", { request_token_path: '/oauth/initiate', access_token_path: '/oauth/token' ,site: "http://shop.myproject.com" })
=> #<OAuth::Consumer:0x000000093955e0 @key="44a1edf5861edf37c", @secret="f87a0e4bfb7663fb78d", @options={:signature_method=>"HMAC-SHA1", :request_token_path=>"/oauth/initiate", :authorize_path=>"/oauth/authorize", :access_token_path=>"/oauth/token", :proxy=>nil, :scheme=>:header, :http_method=>:post, :oauth_version=>"1.0", :site=>"http://shop.myproject.com"}>
@request_token = @consumer.get_request_token
=> Got good response and request_token is good
From magento docs:
User Authorization
The second step is to request user authorization. After receiving the Request Token
from Magento, the application provides an authorization page to the user. The only
required parameter for this step is the Request Token (oauth_token value) received from
the previous step. The endpoint is followed by an oauth_token parameter with the value
set to the oauth_token value.
@access_token = @request_token.get_access_token
OAuth::Unauthorized: 400 Bad Request
기본적으로 나는 액세스 토큰 클릭에 대한 사용자 교환 요청 토큰 허용하거나 사용자 이름과 암호를 입력 페이지에 있어요. 하지만 백그라운드에서 모든 것을해야하기 때문에 액세스 토큰을 요청하기 전에 어떤 단계가 필요합니다. 나는 이것을 어떻게하는지 문서화에서 찾을 수없고 PHP 배경도 없다.
이미 읽은3 댓글 섹션의 다른 자세한 내용은 저에게 문의하십시오.