Why does Twitter OAuth reject request token request with message "The given URL is considered malware"?

StackOverflow https://stackoverflow.com/questions/23248088

  •  08-07-2023
  •  | 
  •  

Question

I'm using Twitter4J, and when I request an OAuth request token, an exception is thrown with the following message:

401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access token/secret, and the system clock is in sync.

<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <error>The given URL is considered malware</error>
  <request>/oauth/request_token</request>
</hash>

Relevant discussions can be found on the Internet at:
    http://www.google.co.jp/search?q=8e063946 or
    http://www.google.co.jp/search?q=ef59cf90
TwitterException{exceptionCode=[8e063946-ef59cf90], statusCode=401, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=4.0.1}

The question In getting request token flow of OAuth, I've received "The given URL is considered malware" appears relevant, but it was closed as "not a real question" and the accepted answer, that my third-party app has been flagged as malware, does not apply to my case. (I have other web apps that allow users to authorize this same third-party app -- same consumer key/secret -- to access their data without getting this error.)

The only thing I could think of is that the callback URL I include in the request for a token is http://localhost:8084/authorize/complete/twitter, and I've never used that callback URL before. But my searches do not reveal restrictions on using localhost or any particular port in a callback URL, and I have a placeholder in the third-party app's Callback URL setting (i.e. the app is not restricted from using callbacks).

What is causing this error and how do I resolve it?

Was it helpful?

Solution

As stated in my comment on the question, the cause was a typo in the callback URL I was providing in the request. The URL I was providing was

http://localhost::8084/authorize/complete/twitter

with an accidental second colon before the port. My bad.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top