I have a client trying to access our private gallery API and they keep receiving an error: "The provided signature (oauth_signature) is invalid." They have tried manipulating the order of the parameters but that hasn't helped and we cannot find an "un-minimized" version of 'oauth-signature.min.js' which they pointed out would help. Has anyone come across an issue with the gallery oauth process and how did you correct for it?
Thanks!
Solved! Go to Solution.
I was able to write some basic working code. The details below.
Working Code Below:
import org.scribe.builder.api.DefaultApi10a;
import org.scribe.model.*;
import java.util.Map;
public class ScribeJavaMain {
private static final String url ="https:// gallery.alteryx.com/gallery/api/v1/workflows/5ff71f96185f0201fc0437e5/jobs/";
private static final String key ="YOUR_KEY_HERE";
private static final String secret ="YOUR_SECRET_HERE";
private static final String body="{\n" +
" \"questions\": [\n" +
" {\n" +
" \"name\": \"Cobdate\",\n" +
" \"value\": \"2020-01-01\"\n" +
" }\n" +
" ],\n" +
" \"priority\": \"0\"\n" +
"}";
public static void main(String[] args) {
DefaultApi10a api = new DefaultApi10a() {
@Override
public String getRequestTokenEndpoint() {
return null;
}
@Override
public String getAccessTokenEndpoint() {
return null;
}
@Override
public String getAuthorizationUrl(Token requestToken) {
return null;
}
};
OAuthRequest request = new OAuthRequest(Verb.GET,url);
request.addOAuthParameter(OAuthConstants.TIMESTAMP, api.getTimestampService().getTimestampInSeconds());
request.addOAuthParameter(OAuthConstants.NONCE, api.getTimestampService().getNonce());
request.addOAuthParameter(OAuthConstants.CONSUMER_KEY, key);
request.addOAuthParameter(OAuthConstants.SIGN_METHOD, api.getSignatureService().getSignatureMethod());
request.addOAuthParameter(OAuthConstants.VERSION, "1.0");
String baseString = api.getBaseStringExtractor().extract(request);
System.out.println("baseString==>"+baseString);
String signature = api.getSignatureService().getSignature(baseString, secret, "");
System.out.println("signature==>"+signature);
request.addOAuthParameter(OAuthConstants.SIGNATURE, signature);
for (Map.Entry<String, String> entry : request.getOauthParameters().entrySet())
{
request.addQuerystringParameter(entry.getKey(), entry.getValue());
}
Response response2 = request.send();
System.out.println(response2.getBody());
}
}
Dependencies :
<dependency>
<groupId>org.scribe</groupId>
<artifactId>scribe</artifactId>
<version>1.3.6</version>
</dependency>
Thank you.
I got some basic working code. The details below.
Working Code Below:
import org.scribe.builder.api.DefaultApi10a;
import org.scribe.model.*;
import java.util.Map;
public class ScribeJavaMain {
private static final String url ="https:// gallery.alteryx.com/gallery/api/v1/workflows/5ff71f96185f0201fc0437e5/jobs/";
private static final String key ="YOUR_KEY_HERE";
private static final String secret ="YOUR_SECRET_HERE";
public static void main(String[] args) {
DefaultApi10a api = new DefaultApi10a() {
@Override
public String getRequestTokenEndpoint() {
return null;
}
@Override
public String getAccessTokenEndpoint() {
return null;
}
@Override
public String getAuthorizationUrl(Token requestToken) {
return null;
}
};
OAuthRequest request = new OAuthRequest(Verb.GET,url);
request.addOAuthParameter(OAuthConstants.TIMESTAMP, api.getTimestampService().getTimestampInSeconds());
request.addOAuthParameter(OAuthConstants.NONCE, api.getTimestampService().getNonce());
request.addOAuthParameter(OAuthConstants.CONSUMER_KEY, key);
request.addOAuthParameter(OAuthConstants.SIGN_METHOD, api.getSignatureService().getSignatureMethod());
request.addOAuthParameter(OAuthConstants.VERSION, "1.0");
String baseString = api.getBaseStringExtractor().extract(request);
System.out.println("baseString==>"+baseString);
String signature = api.getSignatureService().getSignature(baseString, secret, "");
System.out.println("signature==>"+signature);
request.addOAuthParameter(OAuthConstants.SIGNATURE, signature);
for (Map.Entry<String, String> entry : request.getOauthParameters().entrySet())
{
request.addQuerystringParameter(entry.getKey(), entry.getValue());
}
Response response2 = request.send();
System.out.println(response2.getBody());
}
}
Dependencies :
<dependency>
<groupId>org.scribe</groupId>
<artifactId>scribe</artifactId>
<version>1.3.6</version>
</dependency>