Connecting to the Magento 1.9 REST API with OAuth 1.0a
Connecting to the Magento 1.9 REST API with OAuth 1.0a
This guide shows how to authorize an application to make read-only product requests to a Magento 1.9.2.4 store using OAuth 1.0a and HMAC-SHA1. Use a test store for practice. OAuth parameters must be signed and sent in the Authorization request header.
Example values
These are placeholders. Replace them with values from your own test store.
- Store:
https://magento.example.test - Callback:
https://client.example.test/oauth/callback - Admin authorization path:
/index.php/admin/shopadmin/oauth_authorize
1. Request a temporary token
In Postman, create a POST request to:
https://magento.example.test/index.php/oauth/initiateConfigure the Authorization tab:
- Type: OAuth 1.0
- Consumer Key and Consumer Secret: your registered test values
- Signature Method: HMAC-SHA1
- Add authorization data to: Request Headers
- Callback URL:
https://client.example.test/oauth/callback
Send the request. Securely save oauth_token and oauth_token_secret from the response. The response should include oauth_callback_confirmed=true.
2. Authorize the temporary token
Sign in to the Magento test store as an Admin, then open this URL in a browser. Replace the placeholder with the temporary token:
https://magento.example.test/index.php/admin/shopadmin/oauth_authorize?oauth_token=TEMPORARY_TOKENApprove the request. The callback receives the token and an oauth_verifier. Save the verifier securely; it is paired with that temporary token.
3. Exchange for an access token
In Postman, create a POST request to:
https://magento.example.test/index.php/oauth/tokenConfigure OAuth 1.0 authorization:
- Use the same Consumer Key and Consumer Secret
- Signature Method: HMAC-SHA1
- Add authorization data to: Request Headers
- Token: the temporary
oauth_token - Token Secret: its matching
oauth_token_secret - Add
oauth_verifieras an OAuth parameter included in the signed header
Send the request once. The response contains the access oauth_token and oauth_token_secret. Store both securely. Access tokens are long-lived and remain valid unless revoked.
4. Make a read-only product request
In Postman, create a GET request to:
https://magento.example.test/index.php/api/rest/products?limit=1Sign the request with OAuth 1.0 and HMAC-SHA1 using the Consumer Key, Consumer Secret, access token, and matching access-token secret. Send OAuth parameters in the Authorization request header. Check the HTTP status and response body to see whether a product was returned.
Troubleshooting
parameter_absent: check that Postman generated the signed OAuth Authorization header and included the required parameter.timestamp_refused: synchronize your computer clock and generate a fresh request.token_rejectedorverifier_invalid: restart with a new temporary token, then use its matching secret and verifier.Admin role not found: assign the Admin user a REST role with product read permissions, then repeat the flow with a fresh temporary token.
Never publish real consumer secrets, token secrets, or verifier values in blog content, screenshots, chat, or source files.