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



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

i'm playing around iloot, open source app let's download icloud backups , wondering how possible implement 2 factor authentication it.

i have 2fa enabled on business relationship , on first request this:

first request:

auth = "basic %s" % base64.b64encode("%s:%s" % (login, password)) authenticateresponse = plist_request("setup.icloud.com", "post", "/setup/authenticate/$apple_id$", "", {"authorization": auth})

plist_request normal python (request) function request url , returns parsed xml.

first response (in xml format):

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> <key>protocolversion</key> <string>2</string> <key>title</key> <string>verification required</string> <key>localizederror</key> <string>mobileme_terms_of_service_update</string> <key>message</key> <string>this apple id protected two-step verification. sign in, must verify identity.</string> </dict> </plist> request /setup/authenticate/$apple_id$ returned code 409

in case knows next phone call input two-step verification code, help figure out.

i'm ios guy, not backend guy, backend team solved on side using app-specific password, instead of tokens.

this how user can generate app-specific password: generate app-specific password

then utilize email , password, instead of token formed dsprsid:mmeauthtoken. learnt teammates, don't have base64 encode, utilize new password, , url:'https://caldav.icloud.com/'

hope helps. nightmare us, no help @ on internet.

update

for more info, these steps used on side (ios):

i phone call https://setup.icloud.com/setup/authenticate/"email@email.com", setting "basic email:password" base64 string "authorization" http header field.

i check response status code. if 401, means password sending app specific password, send password (and email) straight server, via our internal api, , using phone call icloud apis, , homecoming me calendars, etc.

if response status code 409, means user tried login normal password, business relationship enabled 2fa, , display error, warning user go , retrieve app-specific-password, , utilize one, lead step 2, above.

i not saying way, worked me. also, don't know what's going on on server side, using straight app-specific-passwrod (and email), job.

python ios apple backup icloud

Comments

Popular posts from this blog

php - Edges appear in image after resizing -

ios8 - iOS custom keyboard - preserve state between appearances -

Delphi change the assembly code of a running process -