Sina Weibo oauth2.0 authorized access token (continued)

Source: Internet
Author: User
Tags oauth

Http://wenku.baidu.com/view/5a3ab0f9f90f76c661371afc.html

Development

NewLangMicroBoJAVA SDKOpenSending

The Java Development on the above page is illustrated in great detail. This article focuses on two areas that are prone to problems.

This is something that has not been mentioned in many documents or is not simply written. For your reference

 

As mentioned in this document, exceptions may occur when running oauth4code. Java, and the array subscript is out of bounds.

Exception in thread "Main" Java. Lang. arrayindexoutofboundsexception: 0

At weibo4j. Examples. oauth2.oauth4code. Main (oauth4code. Java: 14)

Solution: replace ARGs [0] And ARGs [1] with an empty string.

Barebonesbrowserlaunch. Openurl (oauth. Authorize ("code ","",""));

System. Out. println (oauth. Authorize ("code ","",""));

This will automatically call the data defined in config. properity, such as app_id

 

 

In the second place, when an accesstoken is obtained and a string starting with 2.0, you can use the token updatestatus. Java

To publish a microblog and test it. the following error may occur after authorization:

 

{"Error": "applications over the unaudited use restrictions! "," Error_code ": 21321," request ":"/2/statuses/update. JSON "}

 

Problem description: it is because sina verification is strict and only allows the current appkey user to test the application before the application is submitted for review during the test period. This error is reported when other users log on to the test.

Therefore, you can only use the user you applied for the appkey to log on to the test, or add a test account to the application you applied for. Now, you can add 15 test accounts to an application. After the application is completed, you can submit the application for review and use it.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.