Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upError 32 ( Authentication Error ) on $cordovaOauth.twitter #45
Comments
This comment has been minimized.
This comment has been minimized.
|
Hi @emgould Did you happen to follow this great tutorial by @saimon24?: http://ionicframework.com/blog/displaying-the-twitter-feed-within-your-ionic-app/ I've not heard any other reports of this error. Can you do a I'm sure Saimon or myself can help you get to the bottom of this. Regards, |
This comment has been minimized.
This comment has been minimized.
emgould
commented
Mar 9, 2015
|
Thanks for the help!! I did review the post originally. Keep in mind. This is not really new development. Meaning this has been working without fail for two months in user test. The log doesn't help much. Here is what happens when I step through it. My function calls $cordovaOauth.twitter(clientId, clientSecret) ... with a valid clientId and clientSecret. However the initial $http request for a token is what fails authorization: With the error returned: error 32 Could not authenticate you. from twitter. How can I help you help me?? The only difference from the blog post in my code is that I put the oauth_callback in the body of the request. So my encoding has: |
This comment has been minimized.
This comment has been minimized.
|
I recently made some changes to Twitter (rumored for the best): Instead of using url-encoded parameters, I switched it to standard parameters. I also changed the header to be local instead of global throughout the application which prevents overlap. When I tested it had worked fine. When I'm home I will try to authenticate again just in case the Twitter API changed between now and the last time I tested (17 days ago). Regards, |
This comment has been minimized.
This comment has been minimized.
emgould
commented
Mar 9, 2015
|
Appreciate your help. This really has perplexed me and actually my code and Saimon code should be the same because the issue is inside $cordovaOauth.twitter which we are both calling. So ignore the above stated differences. As I was comparing the code where a token is already restored from localStorage. |
This comment has been minimized.
This comment has been minimized.
emgould
commented
Mar 9, 2015
|
Additionally, I noticed those changes and I believe I tested it both ways. Both gave me the same error. Happy to share my client secret/key in private message. I have regenned the tokens and had the same result. |
This comment has been minimized.
This comment has been minimized.
|
Let me first test on my setup tonight which I've confirmed working in the past and then I'll circle back. I'll be testing with the latest version of Ionic and the latest version of this library. Regards, |
This comment has been minimized.
This comment has been minimized.
emgould
commented
Mar 9, 2015
|
Just fyi: this is output of console: The error Object is : { code: 32, message: "Could not authenticate you" } |
This comment has been minimized.
This comment has been minimized.
emgould
commented
Mar 9, 2015
|
I used POSTMan and sent the request by hand and compared the headers generated by Twitter's oauth tool vs ng-cordova-oauth. The difference seems to be the repetition of "Authorization" in the header parameter name and body. Unfortunately I can't test more from where I am but by prepending "Authorization:" to the parameter body did result in Postman returning status=200. Although I could need verify if it would return the token. Hope that helps. |
This comment has been minimized.
This comment has been minimized.
|
This is very odd. My code which I don't change and was previously working, is now not working. So I'm wondering what the heck changed in the Twitter API. Maybe they fixed a bug that was allowing lenient behavior? I am going to do a bit of digging. I am definitely stumped though because the authorization header matches what Postman creates and I confirmed Postman is working fine. |
This comment has been minimized.
This comment has been minimized.
emgould
commented
Mar 10, 2015
|
I built the todo app with an attempt to authenticate. So very basic app. Same problem. Code: .run(function($ionicPlatform,$cordovaOauth) { |
This comment has been minimized.
This comment has been minimized.
emgould
commented
Mar 10, 2015
|
Yeah...crazy. Old code and new code doesn't work. In case you did not see that. |
This comment has been minimized.
This comment has been minimized.
|
The problem is definitely in the following: $http({
method: "post",
url: "https://api.twitter.com/oauth/request_token",
headers: {
"Authorization": signatureObj.authorization_header
},
params: {
"oauth_callback": "http://localhost/callback"
}
})But like you, I did compare the authorization header of ngCordovaOauth with the authorization header generated by Postman and they are the same. In fact, when I add a print statement to the ngCordovaOauth library to print the header and then paste it into Postman it works fine. You have any more ideas? A solution would be so much easier if we could figure out what exactly changed between now and a few weeks ago. |
This comment has been minimized.
This comment has been minimized.
vsanasc
commented
Mar 10, 2015
|
I have the same problem!! A week ago my application login perfectly with twitter and now not working. |
This comment has been minimized.
This comment has been minimized.
|
The three of us are smart and I know we can come up with a solution. The more great minds on this problem the quicker we can beat it. Let us know what you find @vsanmaster |
This comment has been minimized.
This comment has been minimized.
emgould
commented
Mar 10, 2015
|
I will continue to look at it but I have been debugging this for a couple of days. Pretty stumped. It is almost like Twitter doesn't want to allow the particular flavor of the angular $http post request. It must be some information that is in the actual http request. Something in the header or not in the header. |
This comment has been minimized.
This comment has been minimized.
|
Yea I was wondering if Twitter was blocking AngularJS requests, but I don't know how that would even make sense. What makes the AngularJS post different than the one that Postman is doing? When I look at the requests they look pretty much the same. Anyone happen to have a contact at Twitter? I haven't seen any news on the internet about changes. |
This comment has been minimized.
This comment has been minimized.
|
Opened a ticket in the Twitter forums: https://twittercommunity.com/t/oauth-endpoint-request-token-stopped-working-all-of-a-sudden/33604 |
This comment has been minimized.
This comment has been minimized.
|
Got it fixed!
Twitter must have changed something that requires the Everything seems to be working. I will update the Ionic ngCordova module in the coming days. In the mean time use my ngCordovaOauth module. Regards, |
nraboy
closed this
Mar 11, 2015
This comment has been minimized.
This comment has been minimized.
emgould
commented
Mar 11, 2015
|
Awesome. Thanks! This did force me to embrace a hybrid model. I know check to see if there is native Twitter connection available, if so then I gen the oauth_token from that and store it. If not I fall back to this libraries approach. |
This comment has been minimized.
This comment has been minimized.
|
There is absolutely nothing wrong with that approach :-) |
This was referenced Mar 13, 2015
asuwend1
referenced this issue
Apr 23, 2015
Closed
Error 32 ( Authentication Error ) on Twitter Search API #64
zocheyado
referenced this issue
Sep 17, 2015
Closed
Twitter not working even with updated service #132
This comment has been minimized.
This comment has been minimized.
dianikol
commented
Sep 27, 2015
|
I'm trying to get twitter login work.. In $cordovaOauthUtility factory you have a createSignature method. console.log('before'); the second console log never triggers. So there must be something wrong there... |
This comment has been minimized.
This comment has been minimized.
dianikol
commented
Sep 27, 2015
|
Ok VERY IMPORTANT. Make sure to download version 1 and not the master branch of sha library.... |
This comment has been minimized.
This comment has been minimized.
|
Yea it is stated in the readme. |
This comment has been minimized.
This comment has been minimized.
tamnv
commented
Oct 14, 2015
|
Hi @nraboy , When i use this API: https://api.twitter.com/1.1/statuses/home_timeline.json, it works fine, but when I change API to: https://api.twitter.com/1.1/trends/place.json?id=1, I got same error: "Failed to load resource: the server responded with a status of 401 (Authorization Required)". It's confusing, |
This comment has been minimized.
This comment has been minimized.
|
My assumption is you're using the API wrong. I offer no support when it comes to provider APIs. As long as you're receiving an access token, my job is done. I might recommend you posting to the Twitter community forums for more specific API help. Best, |
This comment has been minimized.
This comment has been minimized.
alacret
commented
Apr 27, 2016
|
@nraboy which is your library version? i'm this week using the latest and i am getting the same error: My code:
Response erro: 32 Could not Authenticate you. should i manually change the code? or is it a new version that fix this? |
This comment has been minimized.
This comment has been minimized.
|
Oauth features have been removed from ng-cordova. You'll have to use ng-cordova-oauth if you wish to use them. |
This comment has been minimized.
This comment has been minimized.
alacret
commented
Apr 28, 2016
|
Ah ok... I've using it... But in android is happening something weird. In my browser it saids "Can not authenticat in a web browser": Ok, but in Android it produces an error, that doesn't have any clue. My code: module.exports = [ function ($scope, $cordovaOauth, TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET) {
} ]; The code stops in the creation of the PROMISE, do you any clue? (please) |
This comment has been minimized.
This comment has been minimized.
|
Per my documentation, the library will not work with Ionic Serve, Ionic Live-Reload, Ionic View, or in a web browser. How many of those categories do you fall into? |
This comment has been minimized.
This comment has been minimized.
alacret
commented
Apr 28, 2016
|
None. I'm testing in the browser with live-reload, in there it said "Can not authenticate in a web browser" this i do for testing the library availability. But the real test is in my android phone. In there, once the create promise code executes, the execution gets stopped. I do not know why |
This comment has been minimized.
This comment has been minimized.
Don't do that. Like I said none of that will work with this library. In regards to the Android phone, what do the ADB logs say? |
This comment has been minimized.
This comment has been minimized.
alacret
commented
Apr 28, 2016
|
I'm testing directly in my phone. Where do i see ADB log? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
alacret
commented
Apr 28, 2016
|
:O I/chromium(27231): [INFO:CONSOLE(2)] "Error: Chosen SHA variant is not supported I think is the JSSHA version |
This comment has been minimized.
This comment has been minimized.
|
Are you using version 1.6.0 like it says in the README? |
This comment has been minimized.
This comment has been minimized.
alacret
commented
Apr 28, 2016
|
No i didn't tell the bower a version, so it install 2.0.0 let me try with the 1.6.0 |
This comment has been minimized.
This comment has been minimized.
alacret
commented
Apr 29, 2016
|
Great it did work. Now i'm stuck on geetting the token from the url. the redirect_uri does not allow file://* and only allows http://* types URL but i don not know how to capture this PD: Sorry to botter, this is my first ionic app |
This comment has been minimized.
This comment has been minimized.
alacret
commented
Apr 29, 2016
|
Done! ... Is there is a way to hide the PAGE NOTE FOUND ERROR? |
This comment has been minimized.
This comment has been minimized.
|
Since explicit grants such as Twitter were never meant to be run client side, this error will always exist due to a race condition. The only way around this would be to host your own callback page remotely so that way it does exist during the other asynchronous requests. |
This comment has been minimized.
This comment has been minimized.
alacret
commented
Apr 29, 2016
|
Ok i got it. As this is a web site integration it occurs to me use a page that they host as a callback URL. |
emgould commentedMar 9, 2015
I have been using ng-cordova-oauth for about 2 months without issue. However now, I the token request always returns error 32. I have verified the client key and secret. I have looked at what is encoded for the signature. I have used the same client key/secret using twitter's oauth tool. Works succesfully with Twitter's generated headers but not the ones from this library. I am at a bit of loss how to continue to debug this. I have played with app permissions on twitter. Nothing seems to get this to return.