Upgrade a user to read/write


#1

Our app is currently read only, but we want to move to read/write for users who want to copy comments to tweets.

I’ve worked out how to use x_auth_access_type to request either read or write permissions for a user, and I’ve set up a test app with read/write permissions. If I always ask for ‘read’ or always ask for ‘write’ everything is OK.

If I sign a user up with ‘read’ permission then try to upgrade them to ‘write’ permission by running the sign-in/authenticate flow they get to the twitter authenticate screen with the appropriate permissions, but pressing the sign-up button does not result in a redirect. The user gets stuck on that twitter page. It looks like the only way past that is to revoke the app’s permissions. I hit a similar issue if the user has granted write permission and I try to sign them in asking only for read

So

  1. How do I upgrade a user from read to write?
  2. How do I login users when I have a mixture of read and write users and I don’t know which they are until they sign in?
  3. Can I do that without asking for write permission from all users?

Phil


#2

Any ideas anyone? Should I give up and move everyone to read/write?


#3

This is a weird corner case bug that we haven’t yet resolved, specifically with the oauth/authenticate flow. Can you give me a little more information about the parameters you’re sending both to oauth/request_token and oauth/authenticate?

You can mitigate the issue for now by using oauth/authorize when upgrading a user instead.


#4

Here’s the flow for the initial read-only login

Get Request Token from https://api.twitter.com/oauth/request_token?oauth_callback=http%3A%2F%2Flocalhost%3A8000%2Faccounts%2Ftwitter%2Flogin%2Fcallback%2F&x_auth_access_type=read

Redirect to https://api.twitter.com/oauth/authenticate?oauth_token=IAHof…z5awZY&oauth_callback=http://localhost:8000/accounts/twitter/login/callback/

Twitter redirects back

Get Access Token from https://api.twitter.com/oauth/access_token?oauth_verifier=ZCWbyJ…JvySJBuEe1b3s

Then when I try to upgrade this user to read/write

Request Token from https://api.twitter.com/oauth/request_token?oauth_callback=http%3A%2F%2Flocalhost%3A8000%2Faccounts%2Ftwitter%2Flogin%2Fcallback%2F&x_auth_access_type=write

Redirect to https://api.twitter.com/oauth/authenticate?oauth_token=4j9KPs6ZuPO4lBG7Nm…DrLfHJA&oauth_callback=http://localhost:8000/accounts/twitter/login/callback/

And the user never comes back


#5

I’ve tried using authorize to upgrade the user from read->write. This does work OK. However, next time that user logs in if I use the authenticate flow with x_auth_access_type=“read” then the user is prompted for permissions again and, again, the redirect back does not happen. I guess I could use authorize all the time, but I’d rather not bother my users with the additional dialogs.

Can you please clearly state whether you believe selectively requesting write permission like this currently works? I wasn’t clear whether it is possible to tweak my stuff to avoid the bug. I’d love to do it this way, but if it doesn’t work I’d rather stop wasting my time. Are you aware of anyone who is successfully doing this with Twitter?


#6

BTW I posted a description of my sign-in flows here, but it seems to have disappeared! - Ah, not to worry, it has reappeared.


#7

I’ve just tried dumping the x_auth_access_type stuff and simply tried changing my app from read to read/write in Twitter. When an existing (read permissions) user logs in they are prompted to accept write permissions and hit this same problem again. They do not get redirected back from twitter

I’m at a loss to see how I can upgrade my app to get write permissions.


#8

Any chance of some help with this? If I have a read-only app and I now need write permissions what’s my best bet? Anyone have this working?


#9

…crickets…


#10

As long as this bug exists in the oauth/authenticate flow, your best will be to just use oauth/authorize instead.


#11

Thanks

For anyone else who finds this problem

  1. Yes, there’s a huge issue with the oauth/authenticate flow if you try to upgrade your app from read only to read/write. You aren’t imagining it, and there’s nothing wrong with your code, and it isn’t a wierd corner-case. It just flat out doesn’t work.
  2. If you dig around you can find people complaining about this for over a year, don’t expect it to be fixed anytime soon
  3. If you have a time machine go back and get write permission for your app from day one, and ask for it from your users from day one.
  4. The only way around the bug is to always use the oauth/authorize flow, which will mean all your users will be asked to re-authorize your app each time they log in. Which they will find very annoying.

#12

A better alternative may be to create a new twitter app with read/write permissions, ditch all your old tokens and switch to the new app.


#13

Thanks @tanktoptv
@episod I wonder why this issue is not a priority to be solved, since a lot of developers complaining from it


#14

I’m having this issue as well


#15

This is sad, you should fix it


#16

+1 for fixing this… Changing your app’s permissions breaking authenticate forevermore is so lame. The way it breaks (leaving users stranded at a twitter.com page with no idea what’s going wrong and no message) is even lamer. Fixing that heinous bug really can’t be rocket science.