javamagentooauthmagento-1.7scribe

Magento Rest "Admin role not found" error


I'm playing with scribe library (https://github.com/fernandezpablo85/scribe-java), trying to get access to a Magento store products, but I'm facing some problems (it's probably Magento configuration).

I'm using the following code:

OAuthService service = new ServiceBuilder().provider(Magento17Api.class).apiKey(MAGENTO_API_KEY).apiSecret(MAGENTO_API_SECRET).build();
OAuthRequest request = new OAuthRequest(Verb.GET, MAGENTO_REST_API_URL
    + "/products");
service.signRequest(accessToken, request);
Response response = request.send();
System.out.println(response.getBody());

But I'm always receiving this response:

{"messages":{"error":[{"code":0,"message":"Admin role not found"}]}}

What am I missing?


Solution

  • I found the solution...

    You should go to Magento Admin -> System -> Permissions -> Users -> Edit YOUR user and give it an "admin" permission in the "Rest Role" tab.