Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Access Token and Access Token Secret from Magento 1.7 REST API

I've registered my application on my magento admin.

already got the Consumer Key and Consumer Secret.

but i have no luck to get the access token and access token secret.

it said

oauth_problem=parameter_absent&oauth_parameters_absent=oauth_consumer_key

Simple REST API

i'm testing based on this link

http://www.magentocommerce.com/api/rest/testing_rest_resources.html

What i need to know the answer is

  1. What must i fill to Header & Data textfield?
  2. How to get the Access Token and Access Secret Token (on Mozilla)?
  3. Is there any tutorial step by step to test any REST API?
like image 780
Josua Marcel C Avatar asked Nov 07 '12 04:11

Josua Marcel C


People also ask

How can I get Magento 2 access token?

To get a token, you need to specify the user's name and password in the payload. By default, an admin token is valid for 4 hours. To change this value, please access to your admin panel and navigate to Stores > Settings > Configuration > Services > OAuth > Access Token Expiration > Admin Token Lifetime (hours).

How can I get customer token in Magento 2 REST API?

To generate a customer's access token, you must specify the customer's username and password in the payload. You do not specify an admin authorization token. By default, a customer token is valid for 1 hour. To change this value, click Stores > Settings > Configuration > Services > OAuth > Access Token Expiration.

HOW CAN I GET REST API token?

You use the POST operation on the api/get_token element to request your unique token that is required to authenticate the REST API requests. , and click Profile. Then, click Show token.


1 Answers

0) Install https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo to your chrome

1) Get an oAuth client tool with command :

sudo gem install oauth

2) Set up the Magento server

3) Get the oAuth tokens

oauth \
  --verbose \
   --query-string \
   --consumer-key v484mnii2jyswedm6uo2cfcjay7uy49snws \
   --consumer-secret koay6845che7giy5lr17gnrhckkbhf8h5 \
   --access-token-url http://www.yourstore.com/magento/oauth/token \
   --authorize-url http://www.yourstore.com/magento/oauth/authorize \
   --request-token-url http://www.yourstore.com/magento/oauth/initiate \
   authorize

RESPOND :

Server appears to support OAuth 1.0a; enabling support.
Please visit this url to authorize:
http://www.yourstore.com/magento/oauth/authorize?oauth_token=ey6fokp0pbzwr1016eb528y5xw1ak5ji

Please enter the verification code provided by the SP (oauth_verifier):
YOUR_CODE_HERE

Response:
  oauth_token_secret: g9kyz8c7zv868d58eav1muih3gxvq763
  oauth_token: aqvlfv9tuexn0mqiydgkaff4ixxg8743c

4) Make the API call

oauth \
    --consumer-key v484mnii2jyswedm6uo2cfcjay7uy49snws \
    --consumer-secret koay6845che7giy5lr17gnrhckkbhf8h5 \ 
    --token aqvlfv9tuexn0mqiydgkaff4ixxg8743c \
    --secret g9kyz8c7zv868d58eav1muih3gxvq763 \ 
    --uri http://www.yourstore.com/magento/api/rest/products \
    debug

try http://www.yourstore.com/magento/api/rest/products


Found it the solution

http://www.aschroder.com/2012/04/introduction-to-the-magento-rest-apis-with-oauth-in-version-1-7/

for php

https://gist.github.com/2469319

like image 160
Josua Marcel C Avatar answered Sep 29 '22 23:09

Josua Marcel C