python - setup.icloud.com two-step verification -


I am playing with an open source app that lets you download iCloud backup and I was wondering how It is possible to implement two factor authentication.

I have 2FF enabled on my account and what I get on the first request:

First request:

  auth = "Basic% ("Setup.icloud.com", "POST", "/ setup / authentication / $ APPLE_ID $", "" "% base64.b64encode ("% s:% s "% (login, password)) authenticationresources = plist_request (" , {"Authorization": auth})  

plist_request is just a normal python () function that requests url and returns a parsed xml

The first response ( In xml format):

   

I'm an iOS boy, not a backend man, but my backend team solved it in my favor Using an app-specific password instead of token.

How can such a user create an app-specific password:

Then just use the email and this password instead of token created by DSPRIID: mmaithtokan as i To learn, you do not need to encode base 64, just use that new password, and url: ''

Hope this helps, it was a nightmare for us, on the internet No help at all.

UPDATE

For more information, I have used these steps in my favor (iOS):

  1. I call the "authorization" http as base64 string and set the "Basic Email: Password" header to "email@email.com" header field

  2. I check the response status code. If 401, this means that the password you are sending is an app specific password, so I send this password (and email) directly to my server through our internal API, and they call it iCloud API , And return me the calendar, etc.

  3. If the response status code is 409, it means that the user tried to log in with a normal password, but his account was enabled for 2fa, and I display an error, to warn the user to go to their app-specific-password and retrieve it, and use one that will proceed above step 2.

I'm not saying that this is just the way, but it worked for me. Besides, I do not know what's going on on the server, but They are using that app-specific-passcode (and perhaps email) directly to work.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -