jberkel / sms-backup-plus

Backup Android SMS, MMS and call log to Gmail / Gcal / IMAP
https://play.google.com/store/apps/details?id=com.zegoggles.smssync
Apache License 2.0
1.79k stars 497 forks source link

Another fix for latest authentication issue #973

Closed coman49 closed 4 years ago

coman49 commented 4 years ago

(edit by @kurahaupo: this method no longer works; Use the IMAP method as explained in #972 and #959)

Another, possibly easier and better, fix for this latest auth issue is to simply use Firefox when logging in. Reconnect the app to your Google account, it will fail to log in using the app at first and will ask to use a browser, Chrome and Dolphin don't seem to work, but if you use Firefox then it does log in and the backups resume successfully in the app.

mr-rubbish commented 4 years ago

Tested, can confirm this method works as a temporary workaround

jeffbelmiro commented 4 years ago

Thank you @coman49 , I Tested it and it's working till now,.

I will just rewrite here the steps to this workaround:

1 - Try to sync SMS normally, it will fail 2 - When it fails, automatically the app will suggest you another auth way, press ok and chose Firefox as the browser to access google. 3 - Login on google with the account used in playstore and then allow the app. 4 - Return to tha app, and try to sync again.

bferrell commented 4 years ago

The web login does work... And if I noticed the login failure right away, not big deal. If I didn't, I get to back up ALL the messages on my phone... Again. This can be quite lengthy (and has to be restarted several times to get to the current, missed, messages).

Maybe backup from "some date" could be implemented?

coman49 commented 4 years ago

Good point. It would also be good if it knew what has already been backed up and what hasn't. I don't think the app reads email, if it doesn't then it could just keep a record locally of the last backed up item so that it knows where to resume. It likely already does this, but seems to reset if email connection is lost.

realuser commented 4 years ago

Will doing this create a duplicate of all text messages already backed up to gmail? And if so, is there any easy way to remove these duplicates?

coman49 commented 4 years ago

Didn't seem to create duplicates for me.

MamaBird26 commented 4 years ago

Thank you @coman49 , I Tested it and it's working till now,.

I will just rewrite here the steps to this workaround:

1 - Try to sync SMS normally, it will fail 2 - When it fails, automatically the app will suggest you another auth way, press ok and chose Firefox as the browser to access google. 3 - Login on google with the account used in playstore and then allow the app. 4 - Return to tha app, and try to sync again.

****Forgive my misunderstanding, but what exactly do you mean, by sync SMS normally? Is this done through the app? I've never had to do that.

realuser commented 4 years ago

I had a lapse in sms backup because I just recently noticed it wasn't working so missed messages for the last several days or so which I wanted to backup. I re-authenticated using firefox and that seemed to work. After a few hours the messages from the last several days were backed up to my gmail and there don't appear to be duplicates. I did not need to press the "BACKUP" button in the app.

MamaBird26 commented 4 years ago

I'm not understanding how to re-authenticate with firefox. Where is that an option?

realuser commented 4 years ago

On my android device I have not set a default browser so every time I click a link I get asked which browser I want to use. If this is not your configuration you should either first set firefox as the default browser or remove the default browser so you get asked every time you click on a link.

  1. Open the SMS Backup+ app.
  2. There is an option "Connect" which should say something like "Connected as somebody@example.com" . Hit the toggle slider so it turns off.
  3. Hit Connect again it will give a pop dialog that it's unable to make a connection do you want to try the browser method. Click OK
  4. Choose firefox (or firefox is set as your default). Authenticate with google by entering your username and password.
  5. Make sure Auto backup is checked (assuming you want that)
  6. Wait a few hours (depending on your autobackup settings)
MamaBird26 commented 4 years ago

Thank you so much!!! I really appreciate it!

nikkopt commented 4 years ago

It did seem to create some duplicates for me, but only a few. For example, i have a group of messages called "Mother, me" with 28 messages and another called "Mother, me, Mother" with 38 messages. One of the groups correctly identifies my mother as a contact and even shows her pic but the other shows her as "+351XXXXXXXXX@unknown.email" if i hover the mouse above her name, with no picture. Both groups have the same messages plus 10 more on one. I can't just delete the group that has less messages because that group has the latest ones and the other doesn't. It happened with 4 other contacts. Instead of having a group of 100 messages per conversation, i have several different conversations with the same person. with a dozen messages each. It's a mess.

bferrell commented 4 years ago

Unfortunately I'm an info packrat.  The sqlite DB the messages are stored in goes back years for me... Over 11000 messages and when the app starts the sync from fresh, they all get sent to gmail/calender again

On 8/14/19 5:38 PM, Mike Ross wrote:

It did seem to create some duplicates for me, but only a few. For example, i have a group of messages called "Mother, me" with 28 messages and another called "Mother, me, Mother" with 38 messages. One of the groups correctly identifies my mother as a contact and even shows her pic but the other shows her as "+351XXXXXXXXX@unknown.email mailto:+351XXXXXXXXX@unknown.email" if i hover the mouse above her name, with no picture. Both groups have the same messages plus 10 more on one. I can't just delete the group that has less messages because that group has the latest ones and the other doesn't. It happened with 4 other contacts. Instead of having a group of 100 messages per conversation, i have several different conversations with the same person. with a dozen messages each. It's a mess.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jberkel/sms-backup-plus/issues/973?email_source=notifications&email_token=ABGVE5JF6F623PZHZBF7EUTQESQPPA5CNFSM4ILHNVEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4KQBAA#issuecomment-521470080, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGVE5K6WRRGSHNYK6VMUSLQESQPPANCNFSM4ILHNVEA.

al-right commented 4 years ago

It works. Yes a workaround, but needed :)

Since it is the first time I use the workaround and use Firefox to login to authenticate I do not know how the SMS Backup+ app reacts when the session/token/login "times out" days/weeks from now.

Maybe @jberkel is able to make SMS Backup+ redirect that re-login attempt to Firefox again without having to re-upload all messages and calendar events whenever it happens. (Or maybe it already works that way when the browser was used in the first place?)

Obviously this new workaround is a bit clunky for many users, but it is better than nothing.

Thanks to Jan and everyone involved in finding workarounds and fixes!

al-right commented 4 years ago

Follow-up: I also get duplicated sms/text messages. I have not counted them. (There is probably a lot.)

Example: There are messages from before I ran the re-sync/re-login with Sms Backup+ / Firefox VS all those messages I finished re-synchronizing today. Between the duplicates it seems I can see that the ONLY difference between the duplicates are date time info in X-smssync-backup-time: X-smssync-backup-time: 16 Aug 2019 10:03:10 GMT vs e.g. X-smssync-backup-time: 3 Aug 2019 15:24:04 GMT the rest of the mail (including headers) is completely identical. Those mails from before the re-sync are all put nicely into related threads of the participants of the sms/text messages where as at least the dupes I have seen are single messages.

I have no idea whether it is possible to clean up the duplicates in an easy way, but maybe it is possible to use imap tools like imap sync: https://imapsync.lamiral.info/FAQ.d/FAQ.Duplicates.txt , and using two email accounts to kind of filter / clean up messages.

Commocean75 commented 4 years ago

I renamed the original folders and created a second folder for any SMS or calls coming in after the fix. I had to tweak the permissions to allow the app to work in the background, and changed it from a battery optimized app to not optimized. It is backing up and placing the calls and texts in the appropriate folders as they come in as they are supposed to. I used Firefox for the initial set up, but do not have it set as my primary browser. Seems as long as it is downloaded, SMS works as it should. Thank God!

nikkopt commented 4 years ago

@Commocean75 you only need firefox to add the app to the list of apps that can access your google account. Once that's done you can uninstall it. In fact, you can even disconnect the app and connect it again (with chrome for example) and it will not fail because it's still on that list.

AceMcFly77 commented 4 years ago

The firefox fix worked for me.

al-right commented 4 years ago

Re. duplicates: Interesting idea @Commocean75 to use a second label to kind of sort the messages that has duplicates - that lead me to think that maybe we could search for the mail headers (the one that contains the mail id e.g. "Message-ID:") using gmails own search mechanisms. And it is - please see https://webapps.stackexchange.com/a/6061 , re. rfc822msgid: , re. msg-id: of rfc822, which hopefully also correspond to Message-ID of rfc5322 and (rfc2392), because then it should be possible to at least search for specific message IDs. Now this does not solve our problem, but if we somehow can get a sorted list that only contain entries of duplicates (the original sms/email as well as the duplicate(s)) then by the date it should be relatively simple to either give those duplicates an extra (new) label and then make some sanity checks (by hand) before deleting those messages that are marked with an extra label. So maybe it is possible to make use of these google scripts mentioned on the same page to accomplish the task of finding duplicates re.: https://webapps.stackexchange.com/a/73544 , so I might do that at some point in time. :)

al-right commented 4 years ago

@nikkopt If you disconnect and connect again I assume you will have to re-sync all sms/text messages again and experience duplicates unless you delete all sms's before re-syncing or do some post-processing (identifying the duplicates and deleting them or live with the duplicates) or do you say it is possible to connect the app again without having to re-resync all the sms's again just to be on the same page? :)

nikkopt commented 4 years ago

@al-right correct, you will either re-sync all messages again or, if you know that all the messages on your phone are already saved on your account, you can just click "ignore" and the app will only sync messages that arrive after that. What i meant to say with my previous post is that you don't need firefox again, even if you disconnect.

vanyacooper commented 4 years ago

I have not had to do this yet because I'm waiting for a part to fix my phone, but when I do it sounds like a great idea to rename the original SMS label/folder to something else BEFORE re-syncing. That way it will be easy to identify the duplicates by date/time and remove them. Thanks!

nikkopt commented 4 years ago

@vjcooper @Commocean75 yesterday i actually tried moving my old conversations to another "folder" and then re-synced my phone again. It didn't work as expected. It seems that you can't have completely identical messages on gmail, even if they are on different "folders", the ones that do seem to be duplicated have some differences that i don't know of.
Anyway, the messages that i moved to the new "folder" got back to the old one when i re-synced my phone. Example: i moved all my messages to a "folder" called "Old SMSs". When i re-synced, i only had one copy of each message that was both on the "Old SMSs" "folder" AND the "SMS" "folder", not 2 different messages, one on each "folder". If i went to one of those folders and deleted one message, they would be gone from BOTH folders. I don't even think that you can call them "folders", you can only create labels on gmail, everything seems to be inside of a single global folder. The only fix for this that i can think of is to use a different account for the new messages.

vanyacooper commented 4 years ago

@nikkopt Thanks a lot for this info it saved me from having to clean up an even bigger mess. It must be using something in the headers to determine which messages are unique. I probably don't need all the message history on my phone anyway if I can look it up in Gmail. So I will probably just delete it from the messaging app and start fresh before I sync. I usually do this when I get a new phone anyway.

Commocean75 commented 4 years ago

When I first started the backup with the new labels, it did seem to confuse it a bit and a few of the first messages did end up in both folders. After that it did seem to sort itself out and all new calls and messages are landing in the new label where they belong. Thank you for letting me know about Firefox not needing installed. I generally use it as my default but I've had the app so long on my phone that I'm thinking I originally put it there with Chrome. Its def good information to have out there for those who don't generally use it. This workaround is way easier than the others I have seen. Originally I tried to go with the custom IMAP settings but kept getting a different error that refused to clear. I'm thinking it may have had to do with the dual folders. I'm just glad to be back up and running.

nikkopt commented 4 years ago

@Commocean75 unfortunately i don't think this will last forever, google will patch it sooner or later since it's a security issue. Fortunately for me, the IMAP method works great. I just tried this "fix" with firefox out of curiosity but since i'm not counting on it to work forever, i reverted to IMAP. I was just comparing two duplicate messages to see if they had any differences on them. They have quite some, differently to what @al-right saw on his messages . Mainly stuff that the app creates, like the X-smssync-id:, X-smssync-thread:, the References: field and of course, the X-smssync-backup-time: field too. I don't know if it's related, but these messages were restored in the past when i bought a new phone. Maybe restoring them to the phone makes it that something changes with their code or id and when a backup is made, they get saved as new messages again because they have different values on those fields, compared to the ones already saved on gmail.

nikkopt commented 4 years ago

By the way, i never do a full restore. I use the option on the app to only restore messages with a star (I go to gmail on my computer and put a star on the messages i want the app to restore). Maybe that's the reason why i don't have duplicates of ALL messages but only some.

al-right commented 4 years ago

A way to fix duplicates is to use Thunderbird, make it read your gmail account and then install the Add on (extension) 'Remove Duplicate Messages (Alternate)'. Now you will have to play around a bit. First and foremost you right click on the folder and select in the menu to remove duplicates, but you might get zero results. In that event simply go to the menu select Tools - Add-on Preferences - Remove Duplicate Messages (Alternate). Then you might be able to see two tabs - if not simply click in 'Message Comparison' text and you will reach the other tab: Here you might want to remove some of the criteria so that you only compare against Message ID. image Now if you right click on a folder you should definietly be able to find duplicates if there are any: image If you click on the rows you will see the message in the main Thunderbird window, which will effectively give you some sort of overview. If you have many messages then obviously you might have to go with your gut feeling - does it work or does it not in your situation. Also you might observe like I when comparing normal mails (not text messages/sms) that mail headers e.g. for bcc, custom headers etc. differ, but that the Message ID is the same indicating that it should be the same message, but in that case you will have to choose if you can live without the differences in the headers or not. So it is a good thing that you can browse before you choose to delete or move the messages to another folder! Cheers :)

Commocean75 commented 4 years ago

@nikkopt I don't doubt they will begin cutting off access as people find new ways. If Google really wanted us to be able to use it, they would have approved the exception. I know I'll eventually have to switch to IMAP, I'm just delaying the inevitable. I'll probably end up moving all of the messages on Gmail to a thumb drive to clear the label out and erase it. Then uninstall and re install without doing a restore. That may clear the second error if is indeed the dup messages throwing it off.

nikkopt commented 4 years ago

@al-right in my case i just deleted the duplicates on gmail itself since i only had around 2 dozen of them (having 2 windows open side by side so i could see if they were really dups) but yeah, people with lot's of duplicates should be happy with that addon. What i can't fix with gmail (and probably not with thunderbird too) is when the app creates more than one thread per conversation (with less than 100 messages). Threads should be filled until they reach 100 messages and a new can be created. Something like this:

-Mom, me (66) -Mom, me (100) -Mom, me (100)

What it really looks like is

-Mom, me (28) -Mom, me (38) -Mom, me (100) -Mom, me (100)

I already deleted the dups on those first 2 threads but I can't merge them (at least i don't know a way of doing it). I already tried this on my old phone (where i keep no messages): -Restoring only those 66 messages -confirming that they all stay in the same conversation in my phone (which they do) -delete the 66 messages from those 2 different threads on gmail -backup the 66 messages on my old phone to gmail They get separated again and i have no idea why. The "to:" and "from:" fields are the same. They are not MMS's or RCS messages. The google sms app happily puts them in the same conversation but SMS backup+ seem to think they are different in a way.

nikkopt commented 4 years ago

I just noticed, messages on the same thread have the same values on "References:" and "X-smssync-thread:" fields. Messages from other threads have other values. Maybe when i restore those 66 messages, these fields are read by the app and it saves them on a database of it's own, so when i back them up again, those values aren't lost and the messages get separated. The google sms app puts them on the same conversation because it only cares about the value on "X-smssync-address:"

VMACH8 commented 4 years ago

After reading this thread the app is now working with workarounds. I'm not clear also in reading the outlook for long term application viability and doesn't appear to be developer support. There's no good alternatives available. I'm reading so much interest keeping it going and hope this can be made to continue and work...

SamuelDSelf commented 4 years ago

The work-around worked with the Samsung browser that is installed on the S10 phone as well.

marsjaninzmarsa commented 4 years ago

Not working anymore, at least for me (same error like with Chrome, App not verified)…

flordagirl commented 4 years ago

The firefox method isn't working for me and I'm using an Android. Samsung and Puffin browsers also didn't make it work. Anyone have a different solution that works currently?

Another, possibly easier and better, fix for this latest auth issue is to simply use Firefox when logging in. Reconnect the app to your Google account, it will fail to log in using the app at first and will ask to use a browser, Chrome and Dolphin don't seem to work, but if you use Firefox then it does log in and the backups resume successfully in the app.

kurahaupo commented 4 years ago

Use the IMAP method as explained in #972 and #959