Note that there are some explanatory texts on larger screens.

plurals
  1. POMagento oauth and REST api trouble
    text
    copied!<p>I’m trying to integrate my ruby on rails app to magento, and I got so far as to make the initial request, get authorized, and I believe I’m getting the final token, but I can’t be sure. Here is what I have in my response:</p> <p>(There’s a lot of stuff here, so skip ahead where I pluck out the import bits)</p> <pre><code> ..... "credentials"=&gt; {"token"=&gt;"r8apb2rcgci9ry5hugcuiqlnwdi0evc1", "secret"=&gt;"8pnyogb4048toujt5rjoq26tqh50vkv5"}, "extra"=&gt; {"access_token"=&gt; #&lt;OAuth::AccessToken:0x007fdd59893468 @consumer= #&lt;OAuth::Consumer:0x007fdd5995f928 @http=#&lt;Net::HTTP mymagentocart.dev:443 open=false&gt;, @http_method=:post, @key="ttuj6ok0ioziv7bcfwi8wprzqe6o4x1e", @options= {:signature_method=&gt;"HMAC-SHA1", :request_token_path=&gt;"/oauth/initiate", :authorize_path=&gt;"/admin/oauth_authorize", :access_token_path=&gt;"/oauth/token", :proxy=&gt;nil, :scheme=&gt;:header, :http_method=&gt;:post, :oauth_version=&gt;"1.0", :site=&gt;"https://mymagentocart.dev"}, @secret="b0maut2ftkg2wb3nm24t263720n7kxqa"&gt;, @params= {:oauth_token=&gt;"r8apb2rcgci9ry5hugcuiqlnwdi0evc1", "oauth_token"=&gt;"r8apb2rcgci9ry5hugcuiqlnwdi0evc1", :oauth_token_secret=&gt;"8pnyogb4048toujt5rjoq26tqh50vkv5", "oauth_token_secret"=&gt;"8pnyogb4048toujt5rjoq26tqh50vkv5"}, @secret="8pnyogb4048toujt5rjoq26tqh50vkv5", @token="r8apb2rcgci9ry5hugcuiqlnwdi0evc1"&gt;}, "oauth_token"=&gt;"jj2dbrea7dimxwc0twibyoikxjazvs6y", "oauth_verifier"=&gt;"83idqmtmb76fe5axad1rf7lhfa3wqxki" ..... </code></pre> <p>I see in the access token, my key and secret:</p> <pre><code>@key="ttuj6ok0ioziv7bcfwi8wprzqe6o4x1e" @secret="b0maut2ftkg2wb3nm24t263720n7kxqa” </code></pre> <p>This is what magento gave me when I created a REST consumer in the admin.</p> <p>Then there’s a bunch of repeated token and secrets, but they’re all the same and fall under the “credentials” label:</p> <pre><code>“token"=&gt;"r8apb2rcgci9ry5hugcuiqlnwdi0evc1" “secret"=&gt;"8pnyogb4048toujt5rjoq26tqh50vkv5” </code></pre> <p>And finally, there’s the oauth_token and oauth_verifier:</p> <pre><code>“oauth_token"=&gt;"jj2dbrea7dimxwc0twibyoikxjazvs6y" “oauth_verifier"=&gt;"83idqmtmb76fe5axad1rf7lhfa3wqxki” </code></pre> <p>So here’s my problem…</p> <p>Which of these do I need to pass with future requests to authenticate straight away without needing to regenerate a token?</p> <p>In my app currently, each time I make a request, it keeps sending me back to the user confirmation screen in magento to authorize.</p> <p>Also, how can I make a request to get my magento user id, name, etc… so I can generate a user in rails app using this info?</p> <p>Thank you!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload