连接到清晰的图表api

时间:2015-10-01 15:49:21

标签: java oauth scribe lucidchart

我试图使用清晰的图表api。他们正在使用oAuth1.but当我试图连接时,我得到以下错误。 响应正文不正确。无法从中提取令牌和密码:'无效的oauth_verifier'

            package rest;

            import org.scribe.builder.ServiceBuilder;
            import org.scribe.builder.api.FacebookApi;
            import org.scribe.model.OAuthRequest;
            import org.scribe.model.Response;
            import org.scribe.model.Token;
            import org.scribe.model.Verb;
            import org.scribe.model.Verifier;
            import org.scribe.oauth.OAuthService;
            import api.LucidApi;

            public class RestManager {

            public void create() {

    OAuthService service = new ServiceBuilder().provider(LucidApi.class)
            .apiKey("302a5264e8eae5e55f03d04c5ea875729fcf37ff")
            .apiSecret("99cdc2c80bd04cdd068b0f9b07a4322fc7254fae")
            .callback("http://localhost:8080/").build();
    System.out.println("ss"+service.getRequestToken().getRawResponse());

    Token requestToken = service.getRequestToken();
    String authUrl = service.getAuthorizationUrl(requestToken);
    System.out.println("authurl" + authUrl);

    Verifier v = new Verifier(service.getRequestToken().getRawResponse());
    Token accessToken = service.getAccessToken(requestToken, v);
    System.out.println("raw response-"+accessToken.getRawResponse());
    OAuthRequest request = new OAuthRequest(Verb.POST, "https://www.lucidchart.com/visio/conversions");
    request.addBodyParameter("reg_level", "free");
    request.addBodyParameter("visio", "@/home/dilshankm/VSD/flowchart.vsd");
    request.addBodyParameter("name", "flowchart.vsd");
    service.signRequest(accessToken, request); // the access token from step                                            // 4
    Response response = request.send();
    System.out.println("response"+response.getBody());
}

}

如何从清晰的图表api中获得验证者?

0 个答案:

没有答案