2

I am trying get access token & access secret but when i try to connect to magento2 rest API i am getting this error, I have tried multiple endpoints urls like rest/V1/, rest/all/V1/ etc but still get Net::HTTPRetriableError: 302 "Found"

Here is the code i am using to access the token

REQUEST_URL = '/oauth/token/request'
ACCESS_URL = '/oauth/token/access'

OAuth::Consumer.new(consumer_key, consumer_secret, site: site, request_token_path: REQUEST_URL, access_token_path: ACCESS_URL)

Can you please advice as to what could be the issue. Thanks.

11
  • you're passing wrong urls. Commented Sep 26, 2018 at 9:11
  • First get admin integration token Commented Sep 26, 2018 at 9:11
  • Hello Aditya, thanks for your reply. I have updated the ticket with the code i use to get the tokens, I am using Oauth Consumer Commented Sep 26, 2018 at 9:28
  • Okay, did you get admin token ? Commented Sep 26, 2018 at 9:29
  • actually the above code works for other url but there is a specific magento store for which i am getting this Net::HTTPRetriableError: 302 "Found" error Commented Sep 26, 2018 at 9:31

1 Answer 1

1

Endpoint

http://magento.host/rest/default/V1/integration/admin/token
  • method : GET

Header

Content-Type application/json

Payload

{
"username": "admin",
"password": "123123q"
}

Response

Magento returns the admin’s access token.

  • This token must be specified in the authorization header of every call that requires admin permissions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.