liebrandapps / FindMyGUI

Apache License 2.0
8 stars 2 forks source link

2FA Input #1

Closed jrperson closed 8 months ago

jrperson commented 8 months ago

I was able to get everything up and running and ran into an issue I can't seem to figure out...the SMS second factor input. In the "pypush_gsa_icloud.py" file there is a function "sms_second_factor" that has a python input asking for the 2FA code. I get the text message from Apple but I never get the prompt to enter this code. Where is this prompt supposed to show?

This same function (sms_second_factor) also takes a context variable (ctx) but then tries to use it to as the anisetteUrl to generate a header. I fixed that in my code. I will push this fix along with some other minute things I ran across as soon as I get through it all.

liebrandapps commented 8 months ago

Thank you for pointing me at the problem. As you marked this as complete, but did not push a fix, I just fixed this one. I hope it works as I don't have an Apple ID 2 SMS 2nd factor for testing.

jrperson commented 8 months ago

I ended up fixing it, so i marked this closed. I haven't pushed a commit yet as I was going to mess with things a little more.

I just took a look at what you changed and that is exactly what I had done. I also added a "break" instead of a "continue" on the while loop for sms_second_factor and trusted_second_factor so it exits the while loop as soon as it has the code instead of having to time out.

I was going to play with the html/js a little bit to pretty it up a smidge as well.

liebrandapps commented 8 months ago

Ok - Go ahead, going to pull your updates when done… Thx

Am 17.01.2024 um 22:45 schrieb jrperson @.***>:

I ended up fixing it, so i marked this closed. I haven't pushed a commit yet as I was going to mess with things a little more.

I just took a look at what you changed and that is exactly what I had done. I also added a "break" instead of a "continue" on the while loop for sms_second_factor and trusted_second_factor so it exits the while loop as soon as it has the code instead of having to time out.

I was going to play with the html/js a little bit to pretty it up a smidge as well.

— Reply to this email directly, view it on GitHub https://github.com/liebrandapps/FindMyGUI/issues/1#issuecomment-1896921495, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFPSYFZJQRRSCGJJUOGZVELYPBBBHAVCNFSM6AAAAABB7A2A4GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJWHEZDCNBZGU. You are receiving this because you commented.

esunke commented 8 months ago

Hi @jrperson , @liebrandapps , I am facing the same issue. No matter how I configure the Apple ID 2FA, I am not prompted for any code. I do receive a SMS. Can you explain the changes or give me a hint what to change? I am running the latest code from the main branch

Thanks, Eik

liebrandapps commented 8 months ago

Did you pull my updates from Wednesday? I fixed the SMS auth based on the hint of jrperson.

esunke commented 8 months ago

I pulled today, so yes. I have the latest coding. I can refresh the data and then I need to add user and password. I submit it and then nothing is changing. In the log I see the message waiting for 2FA. I tried with SMS and trusted device. The behavior does not seem to change. so where should the token input field show up?

liebrandapps commented 8 months ago

It is important to configure SMS vs. trusted device according to your Apple ID setup - otherwise the device won't get a 2 FA code. Normally, the browser prompts you for the 2FA code. The field shows up at the same place as the user & password are queried if not configured on the server. You should be able to see a message ping pong on the server side and in the console log of the browser (wait ... wait ... done -- something like that).

esunke commented 8 months ago

The configuration seems to be ignored. In any case, I get an SMS. After some tries, I get the exception that the appleid is locked. when I click on update data, I see user id and password. After applying, the two fields diaper and I get a SMS. But I do not see any field to enter my code.I am running this on a Mac, The anisette servier is started as docker container locally. But I do see requests in the log when I try to fetch data. Any further thoughts?

liebrandapps commented 8 months ago

If you get an SMS, then your config is right. Unfortunately, I do not have a apple ID using SMS as 2nd FA. I just logged in explicitly again. Funny enough, log in was successful w/o asking for the 2nd Factor. Difficult to test.

A possible workaround: run the Biemster/FindMy app. This is purely on the command line and thus avoids the complexity of taking the 2FA code in the browser. Once you logged on successfully, copy the created "auth.json" file to this project into the findmy folder. The code always tries to use the content of the json to query before trying to log on. I did enter my credential beginning of December for the last time , since then it uses the auth file...

esunke commented 8 months ago

Yes, that did the trick. with the console based auth, I had no issues. Thanks, Eik

jrperson commented 8 months ago

@esunke @liebrandapps To get the SMS prompt to trigger I had to change the "code.js" file if statement on line 228 to "if (jsn.status === "auth") {". The signInStatus response is listening for "factor" when the api.py _signInStatus code sends "auth" so you never get the prompt.

I also had to remove the "ctx.signInDone = True" line in pypush_gsa_icloud.py line 354 as this was sending "done" and skipping the "auth" prompt.

liebrandapps commented 8 months ago

Thank you for the fix! I just added it to the code.