1

I am doing OAuth1 authentication for Magento2.0. I am referring this doc: https://devdocs.magento.com/guides/v2.0/get-started/authentication/gs-authentication-oauth.html.

I am trying to do this using Postman. I have followed steps mentioned in : Magento 2: Where does the oAuth verifier token come from

1. Get request token: I could get it using Consumer key and consumer secret generated by integration and POST /oauth/token/request.

Response was: oauth_token=xxxxx&oauth_token_secret=xxxxx

enter image description here

2. Get oauth_verifier: Got the oauth_verifier using POST http://mywebsite.com/rest/V1/integration/admin/token. Used consumer key,consumer secret, request token and request token secret along with payload: { "username":"myemail@domain.com", "password":"mypassword" } enter image description here

3. Get access token: When I try to get the access token I face some issues. Added oauth_verifier to Authorization Header.

Authorization: OAuth oauth_signature_method="HMAC-SHA1", oauth_consumer_key="your_consumer_key", oauth_version="1.0", oauth_timestamp="1482575080", oauth_nonce="2142790194", oauth_verifier="THE_OAUTH_VERIFIER_YOU_RECEIVED", oauth_token="your_oauth_request_token", oauth_signature="HMAC-SHA1_SIGNATURE_GENERATED_BY_POSTMAN_CLIENT"

I tried POST /oauth/token/access by 2 ways:

1. Using online curl tool: I got "oauth_problem=OAuth+version+%5C%221.0%5C+is+not+supported" error. enter image description here

2. Using Postman: I got "oauth_problem=Token+verifier+and+verifier+token+do+not+match" error. enter image description here

I searched for these errors but could not get much information.

Any help on this would be appreciated.

  • Have you generated oauth token using integration ? – Aditya Shah Jun 19 '18 at 12:23
  • I could generate the access token and access token secret using integration (keeping the Callback and Identity link URL blank). But I dont want to use that way. I want to use POST APIs to get request token and access token. I was able to get request token and oauth_verifier but not able to get the oauth_token. – Prajakta Jun 19 '18 at 12:26
  • There are 2 types of token 1. Admin and 2. Customer – Aditya Shah Jun 19 '18 at 12:26
  • You can fetch those token by POSTMAN and curl – Aditya Shah Jun 19 '18 at 12:27
  • are you looking for those token ? if yes, then i post an answer – Aditya Shah Jun 19 '18 at 12:27
0

Endpoint

POST http://<host>/rest/default/V1/integration/admin/token

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.
  • Yes. But I thought further I would get an access token. I could not get it. I want the access token. Could you refer the doc which I have mentioned in the question. I have followed those steps. But last step to get the access token is giving me error. – Prajakta Jun 20 '18 at 5:40
  • Are you using POSTMAN ? if yes then please share the sceen shot so i can help you out. – Aditya Shah Jun 20 '18 at 5:41
  • Yes I am using Postman. Will attach screen shot and modify question. – Prajakta Jun 20 '18 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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