Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oauth_problem_advice: Failed to validate signature #245

Open
GoogleCodeExporter opened this issue Oct 14, 2015 · 0 comments
Open

oauth_problem_advice: Failed to validate signature #245

GoogleCodeExporter opened this issue Oct 14, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

This's my code in Maventproject

public void testKey() {
    try {

        XeroClient xeroClient = null;
        xeroClient = new XeroClient(endpointUrl, consumerKey, consumerSecret, praviteKey);

        xeroClient.postContacts();
    } catch (Exception e) {
        // TODO: handle exception
        e.printStackTrace();
    }
}


public void postContacts() {
    try {

        String postXML = "<Contact>" + "<Name>Contact Name</Name>" + "<ContactNumber>002</ContactNumber>" + "</Contact>";
        OAuthClient client = new OAuthClient(new HttpClient3());
        OAuthAccessor accessor = buildAccessor();
        OAuthMessage m = client.invoke(accessor, OAuthMessage.PUT, endpointUrl + "Contacts", OAuth.newList("xml", postXML));
        System.out.println(OAuthMessage.readAll(m.getBodyAsStream(), "UTF-8"));
    } catch (Exception e) {
        // TODO: handle exception
        e.printStackTrace();
    }
}

pom.xml
  <repositories>
        <repository>
            <id>oauth</id>
            <name>OAuth Repository</name>
            <url>https://code.google.com/p/oauth/source/detail?r=1236</url>
        </repository>
    </repositories>

<dependency>
            <groupId>net.oauth.core</groupId>
            <artifactId>oauth</artifactId>
            <version>20100527</version>
        </dependency>
        <dependency>
            <groupId>net.oauth.core</groupId>
            <artifactId>oauth-consumer</artifactId>
            <version>20100527</version>
        </dependency>
        <dependency>
            <groupId>net.oauth.core</groupId>
            <artifactId>oauth-httpclient3</artifactId>
            <version>20090617</version>
        </dependency>

Output:
Unable to respond to any of these challenges: {oauth=OAuth Realm="14.161.2.13"}
11:35:41.954 [http-8080-1] DEBUG httpclient.wire.content - << 
"oauth_problem=signature_invalid&oauth_problem_advice=Failed%20to%20validate%20s
ignature"
net.oauth.OAuthProblemException: signature_invalid
oauth_problem_advice: Failed to validate signature




Original issue reported on code.google.com by [email protected] on 19 Mar 2014 at 4:48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant