加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – org.scribe.exceptions.OAuthException:响应正文不正确

发布时间:2020-12-15 02:30:54 所属栏目:Java 来源:网络整理
导读:OAuthService service = new ServiceBuilder() .provider(GoogleApi.class) .apiKey("198898816518.apps.googleusercontent.com") .apiSecret("hpvFCWHt6ZxWqO-DLwF062rO") .scope(SCOPE) .build(); Token requestToken = null; requestToken = service.getR
OAuthService service = new ServiceBuilder()
                .provider(GoogleApi.class)
                .apiKey("198898816518.apps.googleusercontent.com")
                .apiSecret("hpvFCWHt6ZxWqO-DLwF062rO")
                .scope(SCOPE)
                .build();

        Token requestToken = null;

        requestToken = service.getRequestToken();

        System.out.println("authorize Scribe here:");
        Token token = new Token("oauth_token","4/qGH3cNdzrdIIMmEsDMTRNhKD9z51");
        System.out.println(AUTHORIZE_URL + requestToken.getToken());
        System.out.println("paste the verifier");

              Verifier verifier = new Verifier("IWqonDH9RCtK0hwyZQlYOUCb");
                      // Trade the Request Token and Verfier for the Access Token

        Token accessToken = service.getAccessToken(token,verifier);

我收到了错误..

org.scribe.exceptions.OAuthException: Response body is incorrect.
Can’t extract token and secret from this: ‘The token is invalid.

提前致谢….

解决方法

我相信你可能正在使用scribe 1.3.0,因为我在做oauth时也遇到了这样的错误.只需将其替换为最新版本,抄写1.3.1,你就可以了…….好像在1.3.0中有些问题……不确定是否完全违反了错误原因,但这对我有用.
你可以从这里下载: scribe 1.3.1

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读