iPhone: why i got this error --- HTTP error 401--- Twitter
Asked Answered
H

3

5

hi i am developing Twitter client on iPhone, here i am using MGTwitter library and OAuthentication, i am Authenticating(sign in) and Getting Request Token,

My problem is, when i send request i am getting error

Request 8DC1F854-0F16-40BF-85EC-669AF0B25FCE failed with error: Error Domain=HTTP Code=401 "The operation couldn’t be completed. (HTTP error 401.)"

how i have to solve this error

Please tell me

Thank you

Holinshed answered 6/1, 2011 at 10:2 Comment(1)
i am calling Twitter service, authorizeURL (twitter.com/oauth/authorize) and i am getting twitter LOG IN and entering my credential on it, then getting my Token and storing it and send back with Request,Holinshed
S
5

Probably twitter is just down and your code is fine.

Scorpio answered 7/1, 2011 at 22:19 Comment(0)
I
12

What worked for me: Go to your twitter app and in Settings set Application Type to "Read and Write".

Now i tried this and the app still gave me the same error. I then opened my twitter account ( the one you are using to login). Click on Settings and Applications and check what the access is against the app that you've made. In case it is Read only, revoke access, go to your iPhone simulator and Reset Content and Settings (you can do this by clicking iOS Simulator on the menu on top of your screen) . Compile the program again and try checking the Reads-Write access in your twitter account now.

This worked for me because basically when i ran the program for the first time, the Application Type was set to Read Only. Changing the Application Type after that doesn't make a difference.

ps: I left the Callback URL blank.

Irvin answered 6/9, 2011 at 13:2 Comment(1)
I tried this. But the error is same. Issue resolves only when i delete app from simulator. How can i resolve this?Wayless
S
5

Probably twitter is just down and your code is fine.

Scorpio answered 7/1, 2011 at 22:19 Comment(0)
F
4

There are two reason: 1. Make sure when you create your application its not "Read Only". 2. Select the Client side application instead of browser/web application.

Forewoman answered 14/7, 2011 at 7:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.