Magento2 REST auth help needed
I'm hanging on this issues for nearly a week and cannot find any sollution. I'm trying to send a REST request to my new Magento2 store. It worked allready, but then the oauth/token forced authentication was activated, now I can't beak through to the backend.
I tried it with the scribe framework v1.8.0, here's my attempt:
public class MagentoApi extends DefaultApi10a {
private static final String BASE_URL = "http://myshopurl.de/";
private static final String AUTHORIZE_URL = "http://myshopurl.de/oauth/oauth_authorize?oauth_token=";
private static final String REQUEST_TOKEN_ENDPOINT = "http://myshopurl.de/oauth/token/request";
private static final String ACCESS_TOKEN_ENDPOINT = "http://myshopurl.de/oauth/token/access";
@Override
public String getAccessTokenEndpoint() {
return ACCESS_TOKEN_ENDPOINT;
}
@Override
public String getRequestTokenEndpoint() {
return REQUEST_TOKEN_ENDPOINT;
}
@Override
public String getAuthorizationUrl(OAuth1RequestToken requestToken) {
return String.format(AUTHORIZE_URL, requestToken.getToken());
}
public static MagentoApi instance() {
return MagentoApi.InstanceHolder.INSTANCE;
}
private static class InstanceHolder {
private static final MagentoApi INSTANCE = new MagentoApi();
private InstanceHolder() {
}
}
}
And here my testclient:
public class AuthTest {
private static final String CONSUMER_KEY = "MYCONSUMERKEYHERE";
private static final String CONSUMER_SECRET = "MYSECRETKEYHERE";
public static void main(String args) throws IOException {
OAuth10aService service = new ServiceBuilder()
.apiKey(CONSUMER_KEY)
.apiSecret(CONSUMER_SECRET)
.debug()
.build(MagentoApi.instance());
final OAuth1RequestToken requestToken = service.getRequestToken();
System.out.println(service.getAuthorizationUrl(requestToken));
final String oauthVerifier = in.nextLine();
final OAuth1AccessToken accessToken = service.getAccessToken(requestToken, oauthVerifier);
final OAuthRequest request = new OAuthRequest(Verb.GET, The_Magento_Get_Categories_REST_URL, service);
service.signRequest(accessToken, request);
final Response response = request.send();
System.out.println(response.getBody());
}
}
The result is appearing in this line:
final OAuth1RequestToken requestToken = service.getRequestToken();
this is the sysout:
Fetching the Request Token...
obtaining request token from http://myshopurl.de/oauth/token/request
setting oauth_callback to oob
generating signature...
using base64 encoder: CommonsCodec
base string is: POST&http%3A%2F%2Fmyshopurl.de%2Foauth%2Ftoken%2Frequest&oauth_callback%3Doob%26oauth_consumer_key%thekey%26oauth_nonce%3D3285773414%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1467397682%26oauth_version%3D1.0
signature is: u4h6pVZw6tU8aj0NdFljBSB3h9o=
appended additional OAuth parameters: { oauth_nonce -> 3285773414 , oauth_signature -> u4h6pVZw6tU8aj0NdFljBSB3h9o= , oauth_callback -> oob , oauth_consumer_key -> thekey, oauth_timestamp -> 1467397682 , oauth_signature_method -> HMAC-SHA1 , oauth_version -> 1.0 }
using Http Header signature
sending request...
response status code: 401
response body: oauth_problem=Consumer+key+has+expired
I'm really begging for help.
Otherwise, is there a possibility to deactivate the authentication via REST at all?
Thank you in advance!
PS: The integration is activated in the backend. I also tried reauthorizing several times.
magento2 rest oauth magento-2.1 integration
bumped to the homepage by Community♦ 16 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I'm hanging on this issues for nearly a week and cannot find any sollution. I'm trying to send a REST request to my new Magento2 store. It worked allready, but then the oauth/token forced authentication was activated, now I can't beak through to the backend.
I tried it with the scribe framework v1.8.0, here's my attempt:
public class MagentoApi extends DefaultApi10a {
private static final String BASE_URL = "http://myshopurl.de/";
private static final String AUTHORIZE_URL = "http://myshopurl.de/oauth/oauth_authorize?oauth_token=";
private static final String REQUEST_TOKEN_ENDPOINT = "http://myshopurl.de/oauth/token/request";
private static final String ACCESS_TOKEN_ENDPOINT = "http://myshopurl.de/oauth/token/access";
@Override
public String getAccessTokenEndpoint() {
return ACCESS_TOKEN_ENDPOINT;
}
@Override
public String getRequestTokenEndpoint() {
return REQUEST_TOKEN_ENDPOINT;
}
@Override
public String getAuthorizationUrl(OAuth1RequestToken requestToken) {
return String.format(AUTHORIZE_URL, requestToken.getToken());
}
public static MagentoApi instance() {
return MagentoApi.InstanceHolder.INSTANCE;
}
private static class InstanceHolder {
private static final MagentoApi INSTANCE = new MagentoApi();
private InstanceHolder() {
}
}
}
And here my testclient:
public class AuthTest {
private static final String CONSUMER_KEY = "MYCONSUMERKEYHERE";
private static final String CONSUMER_SECRET = "MYSECRETKEYHERE";
public static void main(String args) throws IOException {
OAuth10aService service = new ServiceBuilder()
.apiKey(CONSUMER_KEY)
.apiSecret(CONSUMER_SECRET)
.debug()
.build(MagentoApi.instance());
final OAuth1RequestToken requestToken = service.getRequestToken();
System.out.println(service.getAuthorizationUrl(requestToken));
final String oauthVerifier = in.nextLine();
final OAuth1AccessToken accessToken = service.getAccessToken(requestToken, oauthVerifier);
final OAuthRequest request = new OAuthRequest(Verb.GET, The_Magento_Get_Categories_REST_URL, service);
service.signRequest(accessToken, request);
final Response response = request.send();
System.out.println(response.getBody());
}
}
The result is appearing in this line:
final OAuth1RequestToken requestToken = service.getRequestToken();
this is the sysout:
Fetching the Request Token...
obtaining request token from http://myshopurl.de/oauth/token/request
setting oauth_callback to oob
generating signature...
using base64 encoder: CommonsCodec
base string is: POST&http%3A%2F%2Fmyshopurl.de%2Foauth%2Ftoken%2Frequest&oauth_callback%3Doob%26oauth_consumer_key%thekey%26oauth_nonce%3D3285773414%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1467397682%26oauth_version%3D1.0
signature is: u4h6pVZw6tU8aj0NdFljBSB3h9o=
appended additional OAuth parameters: { oauth_nonce -> 3285773414 , oauth_signature -> u4h6pVZw6tU8aj0NdFljBSB3h9o= , oauth_callback -> oob , oauth_consumer_key -> thekey, oauth_timestamp -> 1467397682 , oauth_signature_method -> HMAC-SHA1 , oauth_version -> 1.0 }
using Http Header signature
sending request...
response status code: 401
response body: oauth_problem=Consumer+key+has+expired
I'm really begging for help.
Otherwise, is there a possibility to deactivate the authentication via REST at all?
Thank you in advance!
PS: The integration is activated in the backend. I also tried reauthorizing several times.
magento2 rest oauth magento-2.1 integration
bumped to the homepage by Community♦ 16 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I'm hanging on this issues for nearly a week and cannot find any sollution. I'm trying to send a REST request to my new Magento2 store. It worked allready, but then the oauth/token forced authentication was activated, now I can't beak through to the backend.
I tried it with the scribe framework v1.8.0, here's my attempt:
public class MagentoApi extends DefaultApi10a {
private static final String BASE_URL = "http://myshopurl.de/";
private static final String AUTHORIZE_URL = "http://myshopurl.de/oauth/oauth_authorize?oauth_token=";
private static final String REQUEST_TOKEN_ENDPOINT = "http://myshopurl.de/oauth/token/request";
private static final String ACCESS_TOKEN_ENDPOINT = "http://myshopurl.de/oauth/token/access";
@Override
public String getAccessTokenEndpoint() {
return ACCESS_TOKEN_ENDPOINT;
}
@Override
public String getRequestTokenEndpoint() {
return REQUEST_TOKEN_ENDPOINT;
}
@Override
public String getAuthorizationUrl(OAuth1RequestToken requestToken) {
return String.format(AUTHORIZE_URL, requestToken.getToken());
}
public static MagentoApi instance() {
return MagentoApi.InstanceHolder.INSTANCE;
}
private static class InstanceHolder {
private static final MagentoApi INSTANCE = new MagentoApi();
private InstanceHolder() {
}
}
}
And here my testclient:
public class AuthTest {
private static final String CONSUMER_KEY = "MYCONSUMERKEYHERE";
private static final String CONSUMER_SECRET = "MYSECRETKEYHERE";
public static void main(String args) throws IOException {
OAuth10aService service = new ServiceBuilder()
.apiKey(CONSUMER_KEY)
.apiSecret(CONSUMER_SECRET)
.debug()
.build(MagentoApi.instance());
final OAuth1RequestToken requestToken = service.getRequestToken();
System.out.println(service.getAuthorizationUrl(requestToken));
final String oauthVerifier = in.nextLine();
final OAuth1AccessToken accessToken = service.getAccessToken(requestToken, oauthVerifier);
final OAuthRequest request = new OAuthRequest(Verb.GET, The_Magento_Get_Categories_REST_URL, service);
service.signRequest(accessToken, request);
final Response response = request.send();
System.out.println(response.getBody());
}
}
The result is appearing in this line:
final OAuth1RequestToken requestToken = service.getRequestToken();
this is the sysout:
Fetching the Request Token...
obtaining request token from http://myshopurl.de/oauth/token/request
setting oauth_callback to oob
generating signature...
using base64 encoder: CommonsCodec
base string is: POST&http%3A%2F%2Fmyshopurl.de%2Foauth%2Ftoken%2Frequest&oauth_callback%3Doob%26oauth_consumer_key%thekey%26oauth_nonce%3D3285773414%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1467397682%26oauth_version%3D1.0
signature is: u4h6pVZw6tU8aj0NdFljBSB3h9o=
appended additional OAuth parameters: { oauth_nonce -> 3285773414 , oauth_signature -> u4h6pVZw6tU8aj0NdFljBSB3h9o= , oauth_callback -> oob , oauth_consumer_key -> thekey, oauth_timestamp -> 1467397682 , oauth_signature_method -> HMAC-SHA1 , oauth_version -> 1.0 }
using Http Header signature
sending request...
response status code: 401
response body: oauth_problem=Consumer+key+has+expired
I'm really begging for help.
Otherwise, is there a possibility to deactivate the authentication via REST at all?
Thank you in advance!
PS: The integration is activated in the backend. I also tried reauthorizing several times.
magento2 rest oauth magento-2.1 integration
I'm hanging on this issues for nearly a week and cannot find any sollution. I'm trying to send a REST request to my new Magento2 store. It worked allready, but then the oauth/token forced authentication was activated, now I can't beak through to the backend.
I tried it with the scribe framework v1.8.0, here's my attempt:
public class MagentoApi extends DefaultApi10a {
private static final String BASE_URL = "http://myshopurl.de/";
private static final String AUTHORIZE_URL = "http://myshopurl.de/oauth/oauth_authorize?oauth_token=";
private static final String REQUEST_TOKEN_ENDPOINT = "http://myshopurl.de/oauth/token/request";
private static final String ACCESS_TOKEN_ENDPOINT = "http://myshopurl.de/oauth/token/access";
@Override
public String getAccessTokenEndpoint() {
return ACCESS_TOKEN_ENDPOINT;
}
@Override
public String getRequestTokenEndpoint() {
return REQUEST_TOKEN_ENDPOINT;
}
@Override
public String getAuthorizationUrl(OAuth1RequestToken requestToken) {
return String.format(AUTHORIZE_URL, requestToken.getToken());
}
public static MagentoApi instance() {
return MagentoApi.InstanceHolder.INSTANCE;
}
private static class InstanceHolder {
private static final MagentoApi INSTANCE = new MagentoApi();
private InstanceHolder() {
}
}
}
And here my testclient:
public class AuthTest {
private static final String CONSUMER_KEY = "MYCONSUMERKEYHERE";
private static final String CONSUMER_SECRET = "MYSECRETKEYHERE";
public static void main(String args) throws IOException {
OAuth10aService service = new ServiceBuilder()
.apiKey(CONSUMER_KEY)
.apiSecret(CONSUMER_SECRET)
.debug()
.build(MagentoApi.instance());
final OAuth1RequestToken requestToken = service.getRequestToken();
System.out.println(service.getAuthorizationUrl(requestToken));
final String oauthVerifier = in.nextLine();
final OAuth1AccessToken accessToken = service.getAccessToken(requestToken, oauthVerifier);
final OAuthRequest request = new OAuthRequest(Verb.GET, The_Magento_Get_Categories_REST_URL, service);
service.signRequest(accessToken, request);
final Response response = request.send();
System.out.println(response.getBody());
}
}
The result is appearing in this line:
final OAuth1RequestToken requestToken = service.getRequestToken();
this is the sysout:
Fetching the Request Token...
obtaining request token from http://myshopurl.de/oauth/token/request
setting oauth_callback to oob
generating signature...
using base64 encoder: CommonsCodec
base string is: POST&http%3A%2F%2Fmyshopurl.de%2Foauth%2Ftoken%2Frequest&oauth_callback%3Doob%26oauth_consumer_key%thekey%26oauth_nonce%3D3285773414%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1467397682%26oauth_version%3D1.0
signature is: u4h6pVZw6tU8aj0NdFljBSB3h9o=
appended additional OAuth parameters: { oauth_nonce -> 3285773414 , oauth_signature -> u4h6pVZw6tU8aj0NdFljBSB3h9o= , oauth_callback -> oob , oauth_consumer_key -> thekey, oauth_timestamp -> 1467397682 , oauth_signature_method -> HMAC-SHA1 , oauth_version -> 1.0 }
using Http Header signature
sending request...
response status code: 401
response body: oauth_problem=Consumer+key+has+expired
I'm really begging for help.
Otherwise, is there a possibility to deactivate the authentication via REST at all?
Thank you in advance!
PS: The integration is activated in the backend. I also tried reauthorizing several times.
magento2 rest oauth magento-2.1 integration
magento2 rest oauth magento-2.1 integration
edited Jul 2 '16 at 7:23
Java_Waldi
asked Jul 1 '16 at 18:36
Java_WaldiJava_Waldi
2301212
2301212
bumped to the homepage by Community♦ 16 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 16 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
According to the error message your consumer key has expired.
You need to access your backend under System > Extensions > Integration choose your integration and click Activate
The full documentation is available here: http://devdocs.magento.com/guides/v2.0/get-started/authentication/gs-authentication-oauth.html
Hello, maybe I needed to say that the integration is activated, I attached a screenshot
– Java_Waldi
Jul 1 '16 at 18:52
@Java_Waldi yes but the expiration is 300 seconds you may need to re activate the integration
– Raphael at Digital Pianism
Jul 1 '16 at 20:53
1
As I allready mentioned above, I allready tried reauthorizing several times. I Also tried setting the expiration time to 0 or max value. Result was always the same. The documentation is not helpful at all because there is no java exaample given.
– Java_Waldi
Jul 2 '16 at 5:35
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f123872%2fmagento2-rest-auth-help-needed%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
According to the error message your consumer key has expired.
You need to access your backend under System > Extensions > Integration choose your integration and click Activate
The full documentation is available here: http://devdocs.magento.com/guides/v2.0/get-started/authentication/gs-authentication-oauth.html
Hello, maybe I needed to say that the integration is activated, I attached a screenshot
– Java_Waldi
Jul 1 '16 at 18:52
@Java_Waldi yes but the expiration is 300 seconds you may need to re activate the integration
– Raphael at Digital Pianism
Jul 1 '16 at 20:53
1
As I allready mentioned above, I allready tried reauthorizing several times. I Also tried setting the expiration time to 0 or max value. Result was always the same. The documentation is not helpful at all because there is no java exaample given.
– Java_Waldi
Jul 2 '16 at 5:35
add a comment |
According to the error message your consumer key has expired.
You need to access your backend under System > Extensions > Integration choose your integration and click Activate
The full documentation is available here: http://devdocs.magento.com/guides/v2.0/get-started/authentication/gs-authentication-oauth.html
Hello, maybe I needed to say that the integration is activated, I attached a screenshot
– Java_Waldi
Jul 1 '16 at 18:52
@Java_Waldi yes but the expiration is 300 seconds you may need to re activate the integration
– Raphael at Digital Pianism
Jul 1 '16 at 20:53
1
As I allready mentioned above, I allready tried reauthorizing several times. I Also tried setting the expiration time to 0 or max value. Result was always the same. The documentation is not helpful at all because there is no java exaample given.
– Java_Waldi
Jul 2 '16 at 5:35
add a comment |
According to the error message your consumer key has expired.
You need to access your backend under System > Extensions > Integration choose your integration and click Activate
The full documentation is available here: http://devdocs.magento.com/guides/v2.0/get-started/authentication/gs-authentication-oauth.html
According to the error message your consumer key has expired.
You need to access your backend under System > Extensions > Integration choose your integration and click Activate
The full documentation is available here: http://devdocs.magento.com/guides/v2.0/get-started/authentication/gs-authentication-oauth.html
answered Jul 1 '16 at 18:44
Raphael at Digital PianismRaphael at Digital Pianism
53.8k20117271
53.8k20117271
Hello, maybe I needed to say that the integration is activated, I attached a screenshot
– Java_Waldi
Jul 1 '16 at 18:52
@Java_Waldi yes but the expiration is 300 seconds you may need to re activate the integration
– Raphael at Digital Pianism
Jul 1 '16 at 20:53
1
As I allready mentioned above, I allready tried reauthorizing several times. I Also tried setting the expiration time to 0 or max value. Result was always the same. The documentation is not helpful at all because there is no java exaample given.
– Java_Waldi
Jul 2 '16 at 5:35
add a comment |
Hello, maybe I needed to say that the integration is activated, I attached a screenshot
– Java_Waldi
Jul 1 '16 at 18:52
@Java_Waldi yes but the expiration is 300 seconds you may need to re activate the integration
– Raphael at Digital Pianism
Jul 1 '16 at 20:53
1
As I allready mentioned above, I allready tried reauthorizing several times. I Also tried setting the expiration time to 0 or max value. Result was always the same. The documentation is not helpful at all because there is no java exaample given.
– Java_Waldi
Jul 2 '16 at 5:35
Hello, maybe I needed to say that the integration is activated, I attached a screenshot
– Java_Waldi
Jul 1 '16 at 18:52
Hello, maybe I needed to say that the integration is activated, I attached a screenshot
– Java_Waldi
Jul 1 '16 at 18:52
@Java_Waldi yes but the expiration is 300 seconds you may need to re activate the integration
– Raphael at Digital Pianism
Jul 1 '16 at 20:53
@Java_Waldi yes but the expiration is 300 seconds you may need to re activate the integration
– Raphael at Digital Pianism
Jul 1 '16 at 20:53
1
1
As I allready mentioned above, I allready tried reauthorizing several times. I Also tried setting the expiration time to 0 or max value. Result was always the same. The documentation is not helpful at all because there is no java exaample given.
– Java_Waldi
Jul 2 '16 at 5:35
As I allready mentioned above, I allready tried reauthorizing several times. I Also tried setting the expiration time to 0 or max value. Result was always the same. The documentation is not helpful at all because there is no java exaample given.
– Java_Waldi
Jul 2 '16 at 5:35
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f123872%2fmagento2-rest-auth-help-needed%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown