PHP Classes

Getting a 401 rejection when trying to post to twitter

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  How to Implement PHP ...  >  All threads  >  Getting a 401 rejection when trying...  >  (Un) Subscribe thread alerts  
Subject:Getting a 401 rejection when trying...
Summary:Getting oAuth rejections when posting to Twitter
Messages:3
Author:Martin Pitt
Date:2014-12-02 16:35:43
 

  1. Getting a 401 rejection when trying...   Reply   Report abuse  
Picture of Martin Pitt Martin Pitt - 2014-12-02 16:35:43
I am getting the following error when trying to post to twitter. I am using the example twitter script.

I have added my client bits (which I know work)

$client->client_id = ' HERE '; $application_line = __LINE__;
$client->client_secret = 'HERE ';

However, on other twitter scripts I have used in the past, i've also been asked to add oAuth keys, but I am not sure where or if I need to with your script??


OAuth client error
Error: it was not possible to access the OAuth request token: it was returned an unexpected response status 401 Response: <?xml version="1.0" encoding="UTF-8"?>
<hash>
<error>Desktop applications only support the oauth_callback value 'oob'</error>
<request>/oauth/request_token</request>
</hash>


  2. Re: Getting a 401 rejection when trying...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-12-02 17:15:10 - In reply to message 1 from Martin Pitt
It seems you created an application for use from desktop. Did you define the callback URL in the Twitter App that you created?

  3. Re: Getting a 401 rejection when trying...   Reply   Report abuse  
Picture of Martin Pitt Martin Pitt - 2014-12-02 17:47:52 - In reply to message 2 from Manuel Lemos
Thanks Manuel,

No I had not set a redirect URL (first time I've ever had to do that).

That's got a response now.

All I need figure out now is to hide the XML output.