I've just been struggling for a few days to get access to my Telegram account on my de-Googled phone.
It seems to be a common problem, but in my case I was overlooking one important point.
Now its fixed I need to write this note for future reference.I know I make things difficult for myself, but I'm very happy with my de-Googled smart phone. As noted in previous posts, its a OnePlus 5 running LineageOS with apps installed via F-Droid; I don't use Google to provide apps, to search the internet or for any other 'services'.
I had been running on LineageOS v17 but decided an upgrade was well over due. To go from one major version to another you do unfortunately have to wipe your phone and start again. I did start by backing up every file from the user internal storage area (mostly images) just in case.
I now have LineageOS v20 installed and the phone does seem to work better in some ways (e.g. I couldn't get finger print login to work with v17, but it works great with v20).
When opening Telegram for the first time after the OS upgrade, I was confronted by a configuration screen.
After entering the country code and phone number, Telegram send you an activation code, ...in my case: 'to the Telegram app running on your other device'.
The other device being my phone before it was wiped! I wasn't getting a copy sent/received via SMS, which is what I really needed.
Several times over the following days I pressed the 'Help' button and sent Telegram emails asking for the code to be sent via SMS or email. No reply!
I found about a million YouTube videos all showing the same solution: basically clear the Telegram user data & cache. I found a number of user comments that this didn't solve their problems. And they never got any responses to their emails to Telegram.
I tried to get the code using my wife's regular phone. Still no joy.
Eventually we tried this on a third phone and a code was sent successfully via SMS to my phone. That's when the penny dropped!
I'd seen a note saying something about first time activation may not work with Telegram FOSS, but thought this referred to initial account sign-up. Well it seems to also relate to re-activation of an existing account.
I also made the mistake of thinking that Telegram on my wife's phone had been installed from the Google store, but it turns out that this is another FOSS copy from F-Droid.
So there we are, a simple solution to a very frustrating problem. Opening Telegram now I see dozens of messages containing activation codes that I was unable to see at the time.
Since the emails that I sent to Telegram via their 'Help' automated system contained device details, including Telegram build & version data, I do wonder why their systems don't recognise this issue and respond with an automatic reply stating the problem: "This won't work with Telegram FOSS"
EDIT 23rd May 2023
Having used another phone to get Telegram working, I found one other problem:-
all contact details from the other phone were added to my phone!
LongStoryShort, the solution was found in: Telegram Settings > Privacy and Security > Contacts > Delete Synced Contacts
I also found I could go to: Telegram Settings > Devices and then terminate a 'still active' session on my phone, but running under the previous version of LineageOS.
I've now setup Telegram on my laptop, as another way in ...just in case!