Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save phaelfp/885d16488ada2d62096ab5fe48a4f79a to your computer and use it in GitHub Desktop.
Save phaelfp/885d16488ada2d62096ab5fe48a4f79a to your computer and use it in GitHub Desktop.
package org.scribe.oauth;
import org.scribe.builder.api.DefaultApi10a;
import org.scribe.model.Token;
/*
* @author jerry
*/
public final class MagentoThreeLeggedOAuth extends DefaultApi10a {
// NOTE as there is no central service for Magento, this does not suit Builder pattern. Must map to your store
private final String BASE_URL = "http://url.magento.com/index.php/";
@Override
public String getRequestTokenEndpoint() {
return BASE_URL + "oauth/initiate";
}
@Override
public String getAccessTokenEndpoint() {
return BASE_URL + "oauth/token";
}
@Override
public String getAuthorizationUrl(Token requestToken) {
return BASE_URL + "webadmin/oauth_authorize?oauth_token=" + requestToken.getToken(); //this implementation is for admin roles only...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment