-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not sending X-Requested-With header #1
Comments
Hey Jan, I'm glad you're trying this out! Hmm... interesting. I haven't had that issue. Couple questions:
If it's not apparent, there are basically 3 functions that do all the authenticating and they occur in order. And get_request_token() is the first in the sequence, and all it does is send an XHR request. -Joseph |
Hey Joseph, thanks for your quick reply!
I'm unsure whether or not he needs the X-Requested-With header. I tried setting this header manualy by doing XHR.setRequestHeader("X-Requested-With","") but nothing changed (not sure about that call anyway ;)) Jan |
Ahhh yes, okay, I know exactly what's going on. No need to go to the debug version for this, but if you wan't to know what's happening at every step feel free. I'm not an expert on OAuth or how Twitter's API works, but the "Unauthorized" error is coming from Twitter's server and they send it if the data sent to Twitter isn't correct or it is missing. Incorrect data would be a bad signature, incorrect keys, etc. My first guess is an incorrect "consumer_key" and/or "consumer_secret". Can you confirm they are set? Also, it will help to have some more info:
|
Yes, i have to admitt that it looks like the keys are wrong. I'll have to confirm that and will come back to you after i did. Thanks for the support! Great work. |
Thanks! I appreciate you trying this out! Also, in your comment where you posted the error log it had your consumer_key and consumer_secret. Be SURE you never do that, lol. I deleted it for ya. It should only print out in the debug version, though. Keep me posted, please post back if it was the keys. |
Your MODIFIED error log was: D/TiAPI (15413): (kroll$3: file:///android_asset/Resources/main_windows/function.js) |
Thanks for that but i shortened them before posting :) Oh and i forgot to say that i call the tweet() method without authorizing before. |
Ok, well if the keys are correct then we have another issue going on. If your keys are coming from your app's config on Twitter's site then they are certainly correct. It looks like you are using the tweet() function and the device hasn't authorized with Twitter yet, so the error is throwing when the authorization sequence happens, specifically when it's trying to get the request tokens. If the "Unauthorized" error is coming from something other than wrong consumer keys then I'll need to beat my head against the wall some more, hahahaha! We'll get this working, just let me know what's up. |
I am getting the same issue while request sent from get_access token , my logs are as follow, Every thing is correct , but I dont know why its giving this error , I am trying to resolved it for several hours :( |
Ok, I haven't had this issue, and I can't replicate it either. That said, can you try something? Try what I found here: http://bugs.jquery.com/ticket/1623, which is setting the X-Requested-With to 'XMLHttpRequest'. XHR.setRequestHeader("X-Requested-With", "XMLHttpRequest"); Should be around line 580 on birdhouse-debug.js, before the XHR.send() line. Can you try that and let us know if that fixes the issue? |
Yes I tried this and set this |
Can you see if this comment fixed anything: There is a supposed issue with the window? |
I just would like to share that I always get a "Twitter: not sending X-Requested-With header" message in the console; in particular when the authorization succeeds! Here is a piece of the log I get in case of success: I'm using Titanium 1.7.0.RC1, with Android 2.2. For me, the problem I had with authorization was solved with the solution proposed by jgoslin in #9 (comment) Regards |
I have the same problem (Twitter: not sending X-Requested-With header). I am using the following code. Ti.include('birdhouse.js'); var BH = new BirdHouse({ I would like to post "Try something out ..." to my twitter page, but nothing post. Do I need more code? When I run the emulator in Titanium, I get Twitter's authorization page with my apps information. I click 'Authorize app" and another Twitter page pops up "Redirecting you back to the application", but nothing post my twitter account. I am using Android API 2.3.3 on the Titanium 1.7 I/ActivityManager( 62): Starting: Intent { cmp=com.palmvalleychurch.mainapp/org.appcelerator.titanium.TiModalActivity (has extras) } from pid 337 |
Hi, Sorry to bother you, but what happens is the following: In the emulator, the window opens on Twitter to authenticate properly. However, when I put the device does not open. By DDMS I managed to get this log: 10-26 13:36:18.608: DEBUG/TiAPI(26790): (kroll$3: app://windows/enviar.js) [211,14333] fn-load_access_token: no file found I did what was recommended in issues # 1, but failed. Can you help me. |
Hi there,
Authorization isn't working as it should. I get an error that says "Twitter: Not sending X-Requested-With header" and i think it comes from get_request_token().
After that the request fails because of "Unauthorized".
Do you have any suggestions on this?
Regards Jan
The text was updated successfully, but these errors were encountered: