gave92 / fbchat-sharp

Facebook Messenger client library for C#

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possibility to send 2FA code when available

QuadlessPyjack opened this issue · comments

Hi there and, firstly, thanks for the work done on this library!
I've had enough of Android and Facebook's bloated engineering so I started working on a lean UWP client for my Lumia 630 phone. Eventually I plan on porting all I need to return to WP10 and its lack of spam or bloat.

Your library exposes a On2FACode callback, which is great, unfortunately, I can't for the life of me figure out a way to ask for user input, wait for user input and read the user's input from a textbox within the same callback.

Now, the quickest, most miserable solution that came to me was polling - and, as expected, this broke the app (serves me right haha). I could set the client as a Singleton and spin the On2FACode callback in a parallel thread then put it to sleep and wake it again when the user finishes typing its 2FA code. I'll probably do just that.

Alternatively, if you could kindly consider exposing in the API something like a MessengerClient.Send2FACode(string input) method, that would be amazing!

Thanks for your time and keep on the awesome work!

Hello, I've added an example that shows how to ask for the 2FA code in a WPF application.
Basically you can use Set2FACallback to set a custom callback that will be called when the 2FA code is needed. In the callback you can open a Dialog, get the input and return in. Let me know if this works for you.