I can't get the oauth working with a callback



Hello everyone,

I’ve been reading 10 threads talking about similar topics, and everyone seems to find a solution - except for me.

Here is what I am trying to achieve: let my website users give me permission to access their Twitter account so I could post on their behalf with a three-legged oAuth.

I am using the “ohmy-auth” library (https://github.com/sudocode/ohmy-auth/blob/master/examples/twitter.php)

Here is my problem:

            'key'      => 'your consumer key',
            'secret'   => 'your consumer secret',
            'callback' => 'your callback url'

If I set “callback” to nothing, it fails.
If I set “callback” to “oob”, it works but requires a PIN, which isn’t what I want.
If I set “callback” to any domain (I’ve tried hundreds, with / without http://, with / without www), it fails
If I set “callback” to a “non-domain” (example: “callback.php”) it works but obviously redirects to “https://api.twitter.com/oauth/callback.php?oauth_token=” which doesn’t exist.

As suggested by other threads, I have already filled the “Callback URL” in the App Management Form (https://apps.twitter.com/app) but it did not solve the problem.
“Enable Callback Locking” is NOT checked.
“Allow this application to be used to Sign in with Twitter” is checked.
If I click “Test Oauth” it sends to a “Denied access” page.

Few examples of what I have tried already and did not work:
‘callback’ => ‘example.com
‘callback’ => ‘http://www.example.com
‘callback’ => ‘http://www.example.com/callback.php
‘callback’ => urlencode (‘http://www.example.com/callback.php’)
all of these lead to “https://api.twitter.com/oauth/authorize?oauth_token=

Any idea what I am doing wrong here?

Thanks in advance!


Hello there,

Anyone to help me out?



What are your app settings set at? https://apps.twitter.com/


Hello abraham,

Thanks a lot for replying! Here are all my settings for that app:

Name - "tweet promo - Oct 2016"
Description - "promote your page"
Website - "http://www.example.com/Home.html"
Callback URL - "http://www.example.com/twitter"
Privacy Policy URL - ""
Terms of Service URL - ""
Enable Callback Locking - NO
Allow this application to be used to Sign in with Twitter - YES
Icon - YES (uploaded)
Organization name - ""
Organization website - “”

Please let me know if you need anything else, some help would really be great at that point! :slight_smile:


Hello @abraham,

Did that help? Do you have suggestions to solve my problem?


Hello Everyone,
Still no suggestion? Anyone to help?


Really no-one to help here?


Have you considered using any of the other libraries that support sign-in with Twitter and provide examples? I’m not familiar with the one you’re trying to use.


Hello @andypiper!
Thank you for your response! No, I haven’t, because I was under the impression that only this one could allow me to achieve what I want. But if you have another library to recommend, I am more than happy to hear your suggestion!

As a reminder, what I want is to be able to let my users connect their Twitter account so I could post on their behalf on their Twitter feed. Any other library that would allow m to achieve that?

Thanks a lot!


Hello @andypiper, can you please suggest a better library to do what I need?


Have you looked at any of the other PHP libraries on our third-party libraries page?