Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

How to use

  1. Copy one of the consumer key pairs to Twidere - Settings - Network - Advanced - Default API Settings
  2. Remove account from Twidere (or just skip this step)
  3. Re-login. It's OK to see "You've already logged in" message.

Twitter公式クライアントのコンシューマキー

Twitter for iPhone

Consumer key: IQKbtAYlXLripLGPWd0HUA
Consumer secret: GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU

Twitter for Android

Consumer key: 3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for Google TV

Consumer key: iAtYJ4HpUVfIUoNnif1DA
Consumer secret: 172fOpzuZoYzNYaU3mMYvE8m8MEyLbztOdbrUolU

Twitter for iPad

Consumer key: CjulERsDeqhhjSme66ECg
Consumer secret: IQWdVyqFxghAtURHGeGiWAsmCAGmdW3WmbEx6Hck

Twitter for Mac (No longer available)

Consumer key: 3rJOl1ODzm9yZy63FACdg
Consumer secret: 5jPoQ5kQvMJFDYRNE8bQ4rHuds4xJqhvgNJM4awaE8

Twitter for Windows Phone

Consumer key: yN3DUNVO0Me63IAQdhTfCA
Consumer secret: c768oTKdzAjIYCmpSNIdZbGaG0t6rOhSFQP0S5uC79g

TweetDeck

Consumer key: yT577ApRtZw51q4NPMPPOQ
Consumer secret: 3neq3XqN5fO3obqwZoajavGFCUrC42ZfbrLXy5sCv8
@kingofjail

This comment has been minimized.

Copy link

commented Jul 1, 2013

not work

@xgaboard

This comment has been minimized.

Copy link

commented Feb 15, 2014

How to apply consumer key and secret:

  1. Logout All accounts.
  2. Input this key/secret
  3. Login.
@skx7

This comment has been minimized.

Copy link

commented May 31, 2014

Thanks 👍

@sendz

This comment has been minimized.

Copy link

commented Dec 31, 2014

It doesn't work anymore? It show error 401 after authorize app.

@philippgeisler

This comment has been minimized.

Copy link

commented Apr 27, 2015

I was sent here from the Android Play Store app description. I have to say to expect any user to know what is meant by "activity tab" and "rate limit" is an unreasonable demand. Why is info on how to apply these keys in a user comment?
This page features not a single line of information on why it exists. It is from 2013, and it is not transparent that this is still relevant information. (And it is, right? According to the shop description.)

@Lyude

This comment has been minimized.

Copy link

commented May 6, 2015

philip, the reason probably has to do with the twitter API unfortunately. Twitter's API poses numerous problems for developers and makes it very hard to work properly. Specifically, the hard limit on the API for tokens probably a huge factor in this, they probably put it on the description page so that not everyone uses it and they don't reach their limit.

@eeconn

This comment has been minimized.

Copy link

commented Jun 4, 2015

Crashes on android M developer preview.

@konomikitten

This comment has been minimized.

Copy link

commented Dec 24, 2015

I've used the Twitter for Android key, put a tab on Twidere for Actives about me, but it only seems to update once or very very slowly? The Official Twitter Android client is showing favourites that don't appear in Twidere for Activities about me, not sure why hoping someone else might know.

@mtedaldi

This comment has been minimized.

Copy link

commented Jul 7, 2016

Changed the key to Twitter for Android and get an "Error 400" now if I try to post a photo. Any idea on how to solve this?

@b9AcE

This comment has been minimized.

Copy link

commented Oct 22, 2016

Some more pairs are listed here.
I have used the "Twitter for Android" pair probably more than 10 times due to reinstalling Android often and I've never had a problem but definitely less rate limit problems/other improvements.

@JuanjoSalvador

This comment has been minimized.

Copy link

commented Jan 31, 2017

Fixed! This deserve a medal.

@kowith337

This comment has been minimized.

Copy link

commented Apr 25, 2017

Tweetdeck key doesn't work anymore, I only trust the TweetDeck key from all of official key because search function doesn't limited to show popular tweet first.

@jerryhou85

This comment has been minimized.

Copy link

commented Dec 7, 2018

Superb! Works like a charm.

@notpushkin

This comment has been minimized.

Copy link

commented Mar 12, 2019

Stopped working today (you can continue to use but can't login anymore)
RIP

@notpushkin

This comment has been minimized.

Copy link

commented Mar 12, 2019

It is a probability that the official apps have switched to the callback method (at least, Twidere behaves the same way as if I specify other keypairs with callback type from here). I suggest everybody who has signed in using the official keys to make a full backup of Twidere data, everybody else keep your fingers crossed and hope the team can do something about it.

@ivantyr

This comment has been minimized.

Copy link

commented Mar 19, 2019

How would I go about making and restoring a backup? I've tried Titanium Backup and restoring it after flashing a different ROM but as soon as I open Twidere again it takes me to the login screen again

@notpushkin

This comment has been minimized.

Copy link

commented Apr 27, 2019

@ivantyr Maybe you have a native Android backup (i. e. via Helium Backup or adb)? It did work for me, although I'm not 100% sure.

@defaultxr

This comment has been minimized.

Copy link

commented May 10, 2019

If anyone else is having trouble with this, here is what I did:

  1. BE EXTREMELY CAREFUL IF YOU FOLLOW THESE INSTRUCTIONS! You will be editing one of Android's system files and if you break the file your phone will likely fail to boot.

ALSO IMPORTANT: You will need to have a phone where you are already logged into the accounts using these official API keys. This is because we will be copying over the credentials from that phone to your new one. If you aren't already logged in with these API keys somewhere, as far as I know, you are out of luck, sorry.

Anyway, from now on I will refer to the phone you're trying to use the official keys on as the "new" phone. The "old" phone is the one where you already have your twitter accounts logged in an d working properly with the official API keys/secrets above.

  1. Make a backup of your new phone's /data/system_ce/0/accounts_ce.db file. This is the file we will be editing. You will need root to access this file. If you mess up this file, your phone will not boot, but simply swapping out the broken file for the backup you made should fix it (it did for me!). If you are unable to log into your phone, you can use adb to get shell access to your phone and manually restore your backed up copy to the original location. Do some googling if you aren't familiar with that.

However, despite all the above, I don't think it is likely you will break your phone if you follow these instructions carefully.

  1. On your new phone, make sure you've already added all of the accounts you want to use these API keys for. For now it's fine to just log into the accounts normally, with Twidere's API key and secret. We will be manually editing the stored API keys and secrets shortly. Close twidere, "Force Stop" it from your phone's settings under "Apps", and then under the "Storage" section for Twidere, click "CLEAR CACHE", just to be safe.

  2. Download "SQLite Editor" app from Google Play: https://play.google.com/store/apps/details?id=com.tomminosoftware.sqliteeditor It is free of charge and worked wonderfully for me. When I used this app, I did not have any of the aforementioned problems mentioned in #2. But still, be careful!

  3. In SQLite Editor, open /data/system_ce/0/accounts_ce.db. Again, you will likely need root on your phone to be able to do this.

  4. Tap "authtokens".

  5. Look for any lines whose "type" says org.mariotaku.twidere.account.token. Tap to select one of those lines, then click "..." in the upper right of the screen and press "Edit".

  6. Under the "authtoken" header, you should see something that starts off with text like {"access_token": . If you see that, you are in the right spot! Again, make sure "type" is org.mariotaku.twidere.account.token.

  7. Repeat steps 4-8 on your old phone.

  8. Make sure the text after "access_token": is in the format "XXXXXXXXXX-NNNNN...". The XXXXXXXXXX should be 10 or so numbers, and the "NNNNN..." part is various numbers and letters (I didn't count how many). These are separated with a dash -. I believe the XXXXXXXXXX is your twitter account ID. The account IDs need to match. Otherwise, go back to step 7 on the old phone and find a different line that has org.mariotaku.twidere.account.token as its type. Once you find a line on your old phone where the twitter account ID matches, proceed to step 11.

  9. Copy the entire text under "authtoken" from your old phone. Email it to yourself or something so you can access that exact text from your new phone. Then erase the "authtoken" field on your new phone and paste in the "authtoken" text you got from your old phone. Click the "EDIT" button at the bottom to save your changes.

  10. For each twitter account you want to use the official API keys for, repeat steps 5-11. I would suggest keeping track of the account IDs of each account after you've done those steps for them so you only do them once and don't miss any. Obviously if you only have one twitter account, don't worry about this step.

  11. The hard part is over. Hooray.

  12. Press back in the SQLite editor app until you get to the screen where you clicked "authtokens". Below it, you should see another line that says "extras". Click it.

  13. Find any lines whose "key" value says extras. Then, scroll over to the right a bit and make sure its "value" field says {"official_credentials":false}. Tap on this line to highlight it, then click "..." in the upper right and then "edit" again.

  14. Change the false part to true. Click "EDIT" to save this entry again.

  15. For each twitter account you have, repeat steps 15 and 16, or until there are no more lines that say {"official_credentials":false}. All of the twitter accounts you want to use the official credentials for will need to say true or else twidere will not know it has official credentials.

  16. Restart your phone.

  17. If you did everything correctly, you will now be using the official API key and secret again for the accounts.

  18. Hooray.

  19. If you use the SQLite Editor app, it's unlikely you will have broken anything, however if you have, you will just need to rollback your /data/system_ce/0/accounts_ce.db file to the backup of it that you made. Remember you can use the adb utility from your computer to get into a shell. adb is even more dangerous than the SQLite Editor, though!

Thinking about it now, it MAY be possible to use this same file to find the official Twitter app's API keys/secrets/etc and copy them into twidere's format, but I'm so disgusted by the official app that I haven't even checked if it stores its information in this database. If you're up to that challenge, or know where to look for the official app's API keys/secrets/etc, then it might just work.

  1. Give both Twidere and SQLite Editor 5 stars on the play store. Consider donating or purchasing them to support their authors.

  2. Consider using Mastodon instead of Twitter, since having to do all of this is Twitter's fault.

@josereyesjrz

This comment has been minimized.

Copy link

commented May 28, 2019

Thinking about it now, it MAY be possible to use this same file to find the official Twitter app's API keys/secrets/etc and copy them into twidere's format, but I'm so disgusted by the official app that I haven't even checked if it stores its information in this database. If you're up to that challenge, or know where to look for the official app's API keys/secrets/etc, then it might just work.

@defaultxr I was able to copy over the keys/secrets from the official Twitter app into Twidere format. The official app token and secret in fact are stored in the same database, but they are found in separate entries: the token is in com.twitter.android.oauth.token and the secret in com.twitter.android.oauth.token.secret. You can then copy their values over into the Twidere authtoken, where you also have to change the consumer key and consumer secret to an official one.

@fanf

This comment has been minimized.

Copy link

commented Jun 4, 2019

@defaultxr: OK, thank you so much fit the explanation, works like a charm and saved my day.
if (like me) you are not connected anymore, don't panic: install Twitter official app as @josereyesjrz explained.

Thank both of you :)

@nlowe

This comment has been minimized.

Copy link

commented Jun 4, 2019

Thanks @josereyesjrz and @defaultxr, that let me re-add my account. However, replies have stopped loading. Is there a step that's missing perhaps?

@josereyesjrz

This comment has been minimized.

Copy link

commented Jun 5, 2019

@nlowe Funny, replies were working for me last week, but they stopped loading now that I check. I don't know how to fix it though, sorry. If I figure it out I'll reply

@defaultxr

This comment has been minimized.

Copy link

commented Jun 5, 2019

@nlowe Do you mean the replies to your tweets that appear in the "interactions" tab, or do you mean the replies that appear under a tweet when you tap on the tweet? If the latter, I have that problem as well. I'm not sure it's related to this process. I assumed it was a change twitter made to their API that resulted in Twidere not being able to load them.

If the former, I really don't know. I wrote out these instructions with as much detail as I could and I haven't had any issues like that when I followed this process.

@nlowe

This comment has been minimized.

Copy link

commented Jun 5, 2019

@defaultxr Yeah, replies to other tweets don't load. Same thing for tweets in a series, only the tweet I'm currently viewing loads. I tried throwing the requests through Fiddler but it looks like there's certificate pinning or something going on as I couldn't get any requests to decrypt. If this is happening to more people I can write up an issue in the repo.

@josereyesjrz I first noticed it this morning.

@fanf

This comment has been minimized.

Copy link

commented Jun 5, 2019

@MttCastelli

This comment has been minimized.

Copy link

commented Jun 5, 2019

So this is, in a sum, to edit org.mariotaku.twidere.account.token this way:

authtokens
access_token << com.twitter.android.oauth.token
access_token_secret << com.twitter.android.oauth.token.secret
consumer_key << 3nVuSoBZnx6U4vzUxf5w
consumer_secret << Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

extras
official_credentials:true

But replies are bugged.

@Malus3

This comment has been minimized.

Copy link

commented Jun 6, 2019

I succeeded to login using the auth method "xAuth" with the consumer keys. (network advanced settings)
Replies are bugged for me too

@Fangh

This comment has been minimized.

Copy link

commented Jun 7, 2019

Error 401 when trying to connect with [this] (https://framapic.org/4rLEVWtuquJv/YBh2nfUD3npq.jpg)

@AlexDaciuk

This comment has been minimized.

Copy link

commented Jun 10, 2019

I succeeded to login using the auth method "xAuth" with the consumer keys. (network advanced settings)
Replies are bugged for me too

thanks! that works, replies works fine for me

@Torvin

This comment has been minimized.

Copy link

commented Jun 10, 2019

@AlexDaciuk

thanks! that works, replies works fine for me

Which one of these work?

  1. You can see reply count on every tweet card
  2. You can see the actual replies when you open a thread
@jcs100

This comment has been minimized.

Copy link

commented Jun 14, 2019

@notpushkin How did you create an adb backup of Twidere?

The following command results in a trivial, 1KB backup file for me:

adb backup -f .\org.mariotaku.twidere.ab -apk org.mariotaku.twidere

There is no error message in the verbose logcat dump:

[ D/BackupManagerService ] Adb backup processing complete.

This behaviour appears to have been reported over 1y ago: https://github.com/TwidereProject/Twidere-Android/issues/1111

@notpushkin

This comment has been minimized.

Copy link

commented Jun 15, 2019

@jcs100 I fucked it up, unfortunately :') Recently I had to recover from it and my account wasn't there (although when I did a regular sign in, my feeds were intact, so at least something was backed up). I was using oandbackup, but as I understand it uses the same mechanism as adb backup. I guess I needed to backup the Android internal account database, not just the Twidere itself.

However, even better is to stay on the side of caution and just follow @defaultxr's instructions above, I guess. (I also think they can be adapted to extract a token from the official app and use it in Twidere :-)

@klardotsh

This comment has been minimized.

Copy link

commented Jul 1, 2019

Just chiming in to confirm that yanking the official app's tokens with @defaultxr's instructions and @josereyesjrz's format notes ~works. I'm on the FDroid distribution so still waiting on threads to not be busted, and I don't seem to get like/rt notifications, but DMs and trending hashtags and most other things seem to be fine.

@notpushkin

This comment has been minimized.

Copy link

commented Jul 1, 2019

Can confirm that xAuth works for me, too. Just use it + update to 3.7.4 (hotfix) to get threads working again. Thanks everybody for your suggestions!

@nlowe

This comment has been minimized.

Copy link

commented Jul 1, 2019

I couldn't get xAuth working with 2FA. It would 401 and then Twitter would text me a temp password which I couldn't get it to accept.

@nikkopt

This comment has been minimized.

Copy link

commented Jul 13, 2019

Doesn't seem to be working right again.. The timeline is missing so much content, mostly likes and replies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.