2017-03-11 5 views
0

Invoke-webrequest로 Adobe.com에 로그인하려고하는데 오류가 발생하지 않지만 로그인 할 수 없습니다. 필 필드를 설치하여 모든 올바른 필드를 가져 왔습니다. 로그인 양식. 그래서, 여기에 로그인하지 않지만 오류를주지 않는 스크립트가 있습니다.invoke-webrequest Adobe.com에 로그인

$wr = Invoke-WebRequest -Uri 'https://adobeid-na1.services.adobe.com/renga-idprovider/pages/login?callback=https%3A%2F%2Fims-na1.adobelogin.com%2Fims%2Fadobeid%2FSunbreakWebUI1%2FAdobeID%2Ftoken%3Fredirect_uri%3Dhttps%253A%252F%252Faccounts.adobe.com%252F%2523from_ims%253Dtrue%2526old_hash%253D%2526api%253Dauthorize%2526reauth%253Dforce&client_id=SunbreakWebUI1&scope=AdobeID%2Copenid%2Csunbreak%2Cacct_mgmt_webui%2Cgnav%2Cadditional_info.account_type%2Csao.cce_private%2Ccreative_cloud%2Cread_countries_regions%2Cupdate_profile.password%2Cadditional_info.roles%2Cupdate_profile.optionalAgreements%2Cupdate_profile.change_password%2Cadditional_info.social%2Csocial.link%2Cunlink_social_account%2Creauthenticated&denied_callback=https%3A%2F%2Fims-na1.adobelogin.com%2Fims%2Fdenied%2FSunbreakWebUI1%3Fredirect_uri%3Dhttps%253A%252F%252Faccounts.adobe.com%252F%2523from_ims%253Dtrue%2526old_hash%253D%2526api%253Dauthorize%2526reauth%253Dforce%26response_type%3Dtoken&display=web_v2&relay=e4a0063e-836e-4c51-8a39-4016d0f8ad8e&locale=en_US&flow_type=token&client_redirect=https%3A%2F%2Fims-na1.adobelogin.com%2Fims%2Fredirect%2FSunbreakWebUI1%3Fclient_redirect%3Dhttps%253A%252F%252Faccounts.adobe.com%252F%2523from_ims%253Dtrue%2526old_hash%253D%2526api%253Dauthorize%2526reauth%253Dforce&idp_flow_type=login&reauthenticate=force' -SessionVariable adobe 

#These are the login values that i got from Fiddler 
$vals = @{ 
    authSrc='AdobeID'; 
    callback=$($wr.Forms[0].Fields.adobeid_callback); 
    #client_id=$($wr.Forms[0].Fields.adobeid_client_id); 
    client_id='SunbreakWebUI1'; 
    client_redirect=$($wr.Forms[0].Fields.adobeid_client_redirect); 
    denied_callback=$($wr.Forms[0].Fields.adobeid_denied_callback); 
    display=$($wr.Forms[0].Fields.adobeid_display); 
    flow=$($wr.Forms[0].Fields.adobeid_flow); 
    flow_type=$($wr.Forms[0].Fields.adobeid_flow_type); 
    force_marketing_permission=$($wr.Forms[0].Fields.adobeid_force_marketing_permission); 
    idp_flow_type=$($wr.Forms[0].Fields.adobeid_idp_flow_type); 
    is_reauthenticating='false'; 
    locale=$($wr.Forms[0].Fields.adobeid_locale); 
    page_name='SignIn_Form'; 
    password='MyPassword1'; 
    relay=$($wr.Forms[0].Fields.adobeid_relay); 
    scope=$($wr.Forms[0].Fields.adobeid_scope); 
    username='[email protected]'; 
    vi='' 
} 
#Now I am logging into adobe with a post. 
$wr2 = Invoke-WebRequest -Uri 'https://adobeid-na1.services.adobe.com/renga-idprovider/pages/login.do' -WebSession $adobe -Method Post -Body $vals 

이러한 모든 URL과 양식 값은 Fiddler에서 가져 왔습니다. 누구나 내가 놓친 것에 대해 생각해 봤어? 또는 스크립트 문제를 해결하는 방법?

My $ vals 해시 테이블은 다음과 같습니다.

Name       Value                                     
----       -----                                     
relay       e4a0063e-836e-4c51-8a39-4016d0f8ad8e                             
username      [email protected]                               
vi                                             
scope       AdobeID,openid,sunbreak,acct_mgmt_webui,gnav,additional_info.account_type,sao.cce_private,creative_cloud,read_countries_regions,update_profile.pass... 
is_reauthenticating   false                                     
password      MyPassword1                                    
authSrc      AdobeID                                    
denied_callback    https://ims-na1.adobelogin.com/ims/denied/SunbreakWebUI1?redirect_uri=https%3A%2F%2Faccounts.adobe.com%2F%23from_ims%3Dtrue%26old_hash%3D%26api%3Da... 
display      web_v2                                     
idp_flow_type     login                                     
locale       en_US                                     
force_marketing_permission  false                                     
flow_type      token                                     
page_name      SignIn_Form                                   
callback      https://ims-na1.adobelogin.com/ims/adobeid/SunbreakWebUI1/AdobeID/token?redirect_uri=https%3A%2F%2Faccounts.adobe.com%2F%23from_ims%3Dtrue%26old_ha... 
client_redirect    https://ims-na1.adobelogin.com/ims/redirect/SunbreakWebUI1?client_redirect=https%3A%2F%2Faccounts.adobe.com%2F%23from_ims%3Dtrue%26old_hash%3D%26ap... 
flow       true                                     
client_id      SunbreakWebUI1                                   

JSON으로 변환하여 성공하지 못했습니다.

도움을 주시면 감사하겠습니다.

+0

코드에서 'websession $ adobe'는 어디에 있습니까? 그게 세션을 만드는거야. 기본적으로'sessionvariable $ adobe'를 작성한 후에'websession $ adobe'를 사용하여 해당 세션에 들어가야합니다. ... [This (http://stackoverflow.com/questions/13756065/) 체크] powershell-invoke-webrequest-websession-not-working)을 참조하십시오. –

+0

매우 긴 첫 줄 끝에 "-SessionVariable adobe"가 있습니다. 그래서 조금 당황 스럽네요. 어도비는 눈에 보이지 않는 숨겨진 무언가를 가지고 있다고 생각합니다. 광산 (분명히 다른 로그인 양식)의 개인 웹 사이트에 대해 동일한 명령 집합을 테스트하고 로그인 할 수있었습니다. 다시 말하지만 Adobe는 백그라운드에서 특별한 소스를 가지고 있다고 생각합니다. –

답변

0

나는 이것을 알아 냈습니다. 너는 사실 정말로 가까웠다. 희망이 도움이 :

$r = Invoke-WebRequest -Uri 'https://adobeid-na1.services.adobe.com/renga-idprovider/pages/login?callback=https%3A%2F%2Fims-na1.adobelogin.com%2Fims%2Fadobeid%2FSunbreakWebUI1%2FAdobeID%2Ftoken%3Fredirect_uri%3Dhttps%253A%252F%252Faccounts.adobe.com%252F%2523from_ims%253Dtrue%2526old_hash%253D%2526api%253Dauthorize%2526reauth%253Dforce&client_id=SunbreakWebUI1&scope=AdobeID%2Copenid%2Csunbreak%2Cacct_mgmt_webui%2Cgnav%2Cadditional_info.account_type%2Csao.cce_private%2Ccreative_cloud%2Cread_countries_regions%2Cupdate_profile.password%2Cadditional_info.roles%2Cupdate_profile.optionalAgreements%2Cupdate_profile.change_password%2Cadditional_info.social%2Csocial.link%2Cunlink_social_account%2Creauthenticated&denied_callback=https%3A%2F%2Fims-na1.adobelogin.com%2Fims%2Fdenied%2FSunbreakWebUI1%3Fredirect_uri%3Dhttps%253A%252F%252Faccounts.adobe.com%252F%2523from_ims%253Dtrue%2526old_hash%253D%2526api%253Dauthorize%2526reauth%253Dforce%26response_type%3Dtoken&display=web_v2&relay=e4a0063e-836e-4c51-8a39-4016d0f8ad8e&locale=en_US&flow_type=token&client_redirect=https%3A%2F%2Fims-na1.adobelogin.com%2Fims%2Fredirect%2FSunbreakWebUI1%3Fclient_redirect%3Dhttps%253A%252F%252Faccounts.adobe.com%252F%2523from_ims%253Dtrue%2526old_hash%253D%2526api%253Dauthorize%2526reauth%253Dforce&idp_flow_type=login&reauthenticate=force' -SessionVariable Adobe 
$form = $r.Forms[0] 
$form.Fields["adobeid_username"] = $username 
$form.Fields["adobeid_password"] = $password 
$r2 = Invoke-WebRequest -Uri "https://adobeid-na1.services.adobe.com/renga-idprovider/pages/login.do" -WebSession $Adobe -Method Post -Body $form.Fields