Magento CE 1.9 REST API – Log in as a Customer

apimagento-1.9rest

I've recently had some success on setting up a REST client via PHP to OAuth authenticate on a Magento 1.8.x backend. I've run the same process over on my Magento CE 1.9.1.0.

Expected authorisation screen:

enter image description here

What actually comes up:

enter image description here

Besides the design difference, it does seem that the router takes me to the frontend rather than the backend. I have created a new REST role called Admin with full privileges and have added my main admin user to that role (same process that I used on Magento CE 1.8.x).

Has anyone else experienced this? Could this possibly be a bug?

It seems that no matter what I type into the 'Log In As A Customer' screen, I get redirected to the main customer login page.

My endpoints are as follows:

$callbackUrl = "http://foo.bar/test.php";
$temporaryCredentialsRequestUrl = "http://foo.bar/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
$adminAuthorizationUrl = 'http://foo.bar/oauth/authorize';
$accessTokenRequestUrl = 'http://foo.bar/oauth/token';
$apiUrl = 'http://foo.bar/api/rest';

Best Answer

It seams to work fine for me.
I get the admin authentication screen.
I think you may have used thisthe authorization url http://magento.root/oauth/authorize instead of http://magento.root/admin/oauth_authorize.

See the examples provided in here.
There are 2 of them. One for admin access and one for customer access. Use the first one Create a simple product as an Admin user with OAuth authentication.

[EDIT]
Urls should look like this:

$callbackUrl = "http://foo.bar/test.php";
$temporaryCredentialsRequestUrl = "http://foo.bar/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
$adminAuthorizationUrl = 'http://foo.bar/admin/oauth_authorize'; //this is what you need.
$accessTokenRequestUrl = 'http://foo.bar/oauth/token';
$apiUrl = 'http://foo.bar/api/rest';