thunderbird / thunderbird-android

Thunderbird for Android – Open Source Email App for Android (fka K-9 Mail)
https://thunderbird.net/
Apache License 2.0
10.05k stars 2.47k forks source link

Use browser when adding Google account on Android One #6167

Open palopezv opened 2 years ago

palopezv commented 2 years ago

Checklist

App version

6.201

Problem you are trying to solve

In order to link a Gmail account to K-9 you have to login using the Google Services OS services, which in practice links up your phone to another account with the consequences it entails: Duplicate calendars, contact lists, and additional services irrelevant to the workings of my phone as I like it. On the other hand, I have secondary Gmail addresses where I receive email. As it is, you have to go through the movements, make sure K-9 works well with that account and then delete said Google account; but your device has already been registered to that account in Google, not nice.

Suggested solution

Create an option for "private login" using a Chrome Tab to retrieve the OAUTH 2.0 token. As an example: This is already implemented in Aqua Mail.

Screenshots / Drawings / Technical details

No response

cketti commented 2 years ago

On my devices K-9 Mail happily adds Gmail accounts that aren't added as device accounts. Are you saying that's not the case for you?

palopezv commented 2 years ago

Yes. For some reason it is forcing full Google Services linkup. I'm using a device with Android One 10.

cketti commented 2 years ago

Interesting. Can you record a video of adding a Gmail account to K-9 Mail?

As a workaround, you could try making another browser (e.g. Firefox) the default before adding an account to K-9 Mail.

palopezv commented 2 years ago

I'll be! I've just tried an account I use one in a full moon and the option for private login showed up. Hmmm. I may have some leftover data from the previous K-9 versions I removed before installing v6. I'll try to purge as much as I can and report back.

palopezv commented 2 years ago

Sigh. It was a false alarm. I'll try to record a video this weekend and upload it.

palopezv commented 2 years ago

@cketti I have the video but it contains too much personal information. How can I deliver it to you?

cketti commented 2 years ago

If it's not too large you can send it to debugging@cketti.de. Otherwise upload it somewhere and send me the link.

cketti commented 2 years ago

From the video it looks like the Google app is intercepting the intent so that the browser isn't launched. I'm guessing this behavior is unique to Android One.

Since I don't have an Android One device I can't reproduce this. If someone affected by this can provide a patch to make K-9 Mail use the browser, I'm happy to merge the change.

ByteHamster commented 2 years ago

Could it be possible that the Google app is set as the default app to handle the link? If so, resetting the default apps from the device settings page corresponding to the Google app could help.

Bubu commented 2 years ago

FWIW, I can't reproduce this on a Nokia 6.1, running Android 10 (Which is afaik an Android One device) in pretty much stock settings (no apps disabled, no firefox installed).

lewri commented 2 years ago

FWIW, I can't reproduce this on a Nokia 6.1 (Which is afaik an Android One device) in pretty much stock settings (no apps disabled, no firefox installed).

That one originally came with Android 8.1 (Oreo), which could be part of the reason. I'm not sure of the full depths of how the 'in app' browser function worked then compared to Chrome, but I imagine it may have been different from current releases.

palopezv commented 2 years ago

This weekend I resorted to extreme measures: a full phone cache deletion after removing the K-9 Installation. After rebooting the phone and installing K-9 again, I cannot reproduce either.

Hypothesis: K-9, the version previous to the release adding Microsoft OAUTH2, cached corrupted configuration settings that are not removed even if purging all data by hand in the phone configuration facility.

Anutrix commented 6 months ago

I use Firefox as default browser so it uses it for login to Google so it doesn't affect other apps at all

palopezv commented 6 months ago

The same can be accomplished with a Chrome page or using a Android System Webview page. Using Firefox is opaque; there is no hint anywhere. Never presume that your users are psychic and can read your intentions and figure out hidden functions just because the author will it.

Anutrix commented 6 months ago

@palopezv I don't think K9 opens Firefox specifically, I was just sharing my personal experience. It just opens your default browser as Android's CustomTabs(https://developer.chrome.com/docs/android/custom-tabs) iirc. Both Firefox and Chrome implement it. Not sure about other browsers.