Not working Consumer key & Consumer secret key. Please Help


#1

Hello,

I came across the error “Authorization failed (server replied with a 401). This can happen if the consumer key was not correct or the signatures did not match.” as well as other errors, but this one seemed to be the most vague one I could not figure out.

After many hours of consulting google, documentation, https://dev.twitter.com/discussions/204, as well as many android sdks for twitter, I found that simply switching out my consumer key and consumer secret key to someone else’s works (XXXX and XXXXX respectively).

Can someone provide some help and insight as to why my consumer key and consumer secret key was not working? This has been a very frustrating experience. Here are my app settings.

Access level Read and write
About the application permission model
Consumer key XXXXX
Consumer secret XXXXXXX
Request token URL https://api.twitter.com/oauth/request_token
Authorize URL https://api.twitter.com/oauth/authorize
Access token URL https://api.twitter.com/oauth/access_token
Callback URL None
Sign in with Twitter Yes

Thank you,

Kenneth Yip


#2

Careful with posting keys to a public forum – I’ve replaced them with placeholders.

There are times when an application record can get in a state where it falls out of a cache, but it doesn’t happen very often.

That said, I think I know what is probably your issue – are you using callback-based OAuth 1.0A? As in does your Android SDK make use of a custom URI scheme and pass a value to oauth_callback on the request token step?

If you look at the 401 error you’re getting in that step (the body of the response) you’ll likely see a hint to your problem:

“Desktop applications only support the oauth_callback value ‘oob’”

If you want to use callback-based OAuth, you need to put a placeholder URL in the callback URL field on your application record.


#3

Thank you. That was the missing element.
If I need some assistance in the future, what is the best method of communication?