document.forms['Login']
document.forms['Login'].IDToken1.value='my_user_id';
document.forms['Login'].IDToken2.value='my_pass_word';
document.forms['Login'].rememberMe.checked=true;
document.forms['Login'].IDToken1.value='my_user_id';
document.forms['Login'].IDToken2.value='my_pass_word';
document.forms['Login'].rememberMe.checked=true;
LoginSubmit();
Thanks very much warwound, I just made a small donation. Grab a beer/coffee on me
I wonder if the 'fake' stuff was the field hint (email@domain.com) and (8-12 characters)... ?
<div style="position: relative" class="input_box_div left">
<input type="text" value="8-12 characters" name="fakePassword" id="fakePassword" tabindex="101" class="fakeiInputTextBox" autocomplete="off">
<input type="password" name="IDToken2" id="password" class="fakeiInputAlteredTextBox" value="" title="Password" maxlength="12" autocomplete="off">
</div>
Dim PostData As String="IDToken1=<username>&IDToken2=<password>&rememberMe=true"
Set-cookie : [swyAuthCookie=AQIC5wM2LY4SfcyoheLENVwfSCa7OKJcwRnrvJr0x7g5xBo.*AAJTSQACMDQAAlMxAAIwMw..*; Domain=.tomthumb.com; Path=/, swyAuthCookie=AQIC5wM2LY4SfcyoheLENVwfSCa7OKJcwRnrvJr0x7g5xBo.*AAJTSQACMDQAAlMxAAIwMw..*; Domain=.randalls.com; Path=/, swyAuthCookie=AQIC5wM2LY4SfcyoheLENVwfSCa7OKJcwRnrvJr0x7g5xBo.*AAJTSQACMDQAAlMxAAIwMw..*; Domain=.dominicks.com; Path=/, swyAuthCookie=AQIC5wM2LY4SfcyoheLENVwfSCa7OKJcwRnrvJr0x7g5xBo.*AAJTSQACMDQAAlMxAAIwMw..*; Domain=.genuardis.com; Path=/, swyAuthCookie=AQIC5wM2LY4SfcyoheLENVwfSCa7OKJcwRnrvJr0x7g5xBo.*AAJTSQACMDQAAlMxAAIwMw..*; Domain=.pavilions.com; Path=/, swyAuthCookie=AQIC5wM2LY4SfcyoheLENVwfSCa7OKJcwRnrvJr0x7g5xBo.*AAJTSQACMDQAAlMxAAIwMw..*; Domain=.vons.com; Path=/, swyAuthCookie=AQIC5wM2LY4SfcyoheLENVwfSCa7OKJcwRnrvJr0x7g5xBo.*AAJTSQACMDQAAlMxAAIwMw..*; Domain=.safeway.com; Path=/, swyAuthCookie=AQIC5wM2LY4SfcyoheLENVwfSCa7OKJcwRnrvJr0x7g5xBo.*AAJTSQACMDQAAlMxAAIwMw..*; Domain=.carrsqc.com; Path=/, swyConsumerlbcookie=03; Domain=.randalls.com; Path=/, swyConsumerlbcookie=03; Domain=.dominicks.com; Path=/, swyConsumerlbcookie=03; Domain=.tomthumb.com; Path=/, swyConsumerlbcookie=03; Domain=.genuardis.com; Path=/, swyConsumerlbcookie=03; Domain=.pavilions.com; Path=/, swyConsumerlbcookie=03; Domain=.vons.com; Path=/, swyConsumerlbcookie=03; Domain=.safeway.com; Path=/, swyConsumerlbcookie=03; Domain=.carrsqc.com; Path=/, SWY_LOGIN_COUNT=1; Path=/, swyAuthCookie=LOGOUT; Domain=.randalls.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, swyAuthCookie=LOGOUT; Domain=.dominicks.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, swyAuthCookie=LOGOUT; Domain=.tomthumb.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, swyAuthCookie=LOGOUT; Domain=.genuardis.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, swyAuthCookie=LOGOUT; Domain=.pavilions.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, swyAuthCookie=LOGOUT; Domain=.vons.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, swyAuthCookie=LOGOUT; Domain=.safeway.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, swyAuthCookie=LOGOUT; Domain=.carrsqc.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, JSESSIONID=33c1a5afb4dd39d7601ea90e1b14; Path=/opensso; Secure]swyAuthCookie=AQIC5wM2LY4SfczY9YLMzrWq5Se6mLzmCHRkpfeiR14g6EM.*AAJTSQACMDQAAlMxAAIwNQ..*; Domain=.randalls.com; Path=/, swyAuthCookie=AQIC5wM2LY4SfczY9YLMzrWq5Se6mLzmCHRkpfeiR14g6EM.*AAJTSQACMDQAAlMxAAIwNQ..*; Domain=.dominicks.com; Path=/, swyAuthCookie=AQIC5wM2LY4SfczY9YLMzrWq5Se6mLzmCHRkpfeiR14g6EM.*AAJTSQACMDQAAlMxAAIwNQ..*; Domain=.genuardis.com; Path=/, swyAuthCookie=AQIC5wM2LY4SfczY9YLMzrWq5Se6mLzmCHRkpfeiR14g6EM.*AAJTSQACMDQAAlMxAAIwNQ..*; Domain=.pavilions.com; Path=/, swyAuthCookie=AQIC5wM2LY4SfczY9YLMzrWq5Se6mLzmCHRkpfeiR14g6EM.*AAJTSQACMDQAAlMxAAIwNQ..*; Domain=.vons.com; Path=/, swyAuthCookie=AQIC5wM2LY4SfczY9YLMzrWq5Se6mLzmCHRkpfeiR14g6EM.*AAJTSQACMDQAAlMxAAIwNQ..*; Domain=.safeway.com; Path=/, swyAuthCookie=AQIC5wM2LY4SfczY9YLMzrWq5Se6mLzmCHRkpfeiR14g6EM.*AAJTSQACMDQAAlMxAAIwNQ..*; Domain=.carrsqc.com; Path=/, swyConsumerlbcookie=04; Domain=.randalls.com; Path=/, swyConsumerlbcookie=04; Domain=.dominicks.com; Path=/, swyConsumerlbcookie=04; Domain=.tomthumb.com; Path=/, swyConsumerlbcookie=04; Domain=.genuardis.com; Path=/, swyConsumerlbcookie=04; Domain=.pavilions.com; Path=/, swyConsumerlbcookie=04; Domain=.vons.com; Path=/, swyConsumerlbcookie=04; Domain=.safeway.com; Path=/, swyConsumerlbcookie=04; Domain=.carrsqc.com; Path=/, SWY_LOGIN_COUNT=1; Path=/, swyAuthCookie=LOGOUT; Domain=.randalls.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, swyAuthCookie=LOGOUT; Domain=.dominicks.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, swyAuthCookie=LOGOUT; Domain=.tomthumb.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, swyAuthCookie=LOGOUT; Domain=.genuardis.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, swyAuthCookie=LOGOUT; Domain=.pavilions.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, swyAuthCookie=LOGOUT; Domain=.vons.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, swyAuthCookie=LOGOUT; Domain=.safeway.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, swyAuthCookie=LOGOUT; Domain=.carrsqc.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, JSESSIONID=33756321f09bd7184bf36123cf92; Path=/opensso; Secure]
It worked by simply parsing the cookie string from one httprequest and inserting it in the second (with httpclient).
#Region Service Attributes
#StartAtBoot: False
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim currentJob As Int = 1
Dim job1 As HttpJob
Dim job2 As HttpJob
End Sub
Sub Service_Create
End Sub
Sub Service_Start (StartingIntent As Intent)
DoJob1
End Sub
Sub Service_Destroy
End Sub
Sub JobDone (Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
Log(job1.GetString)
If Job.Success = True Then
currentJob = 2
Else
Log("Error in job [" & Job.JobName & "] with error [" & Job.ErrorMessage)
End If
Job.Release
If currentJob = 2 Then
DoJob2
currentJob = 3
End If
End Sub
Sub DoJob1
job1.initialize("Login", Me)
Dim Url1 As String="https://auth.safeway.com/opensso/UI/Login"
Dim PostData1 As String="IDToken1=<*my_email*>&IDToken2=<*my_password*>&rememberMe=true"
job1.PostString(Url1, PostData1)
End Sub
Sub DoJob2
job2.Initialize("Add All Coupons", Me)
Dim Url2 As String="http://www.safeway.com/IFL/Grocery/Home"
Dim PostData2 As String=("javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement(~script~);c.type=~text/javascript~;c.src=~http://ajax.googleapis.com/ajax/libs/jquery/~+g+~/jquery.min.js~;c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d==~loaded~||d==~complete~)){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,~1.7.2~,function($,L){function OfferProcessor(c,f){var d=c;var b=0;var a=f;var e=~/Clipping1/services/clip/offers~;return{processOffers:function(l){var p=l.offers;var n=0;for(var m=0;m<p.length;m++){var o=p[m];if(o.clipStatus===~U~){n++;var g=[];var k={};k.offerId=o.offerId;k.offerPgm=o.offerPgm;g.push(k);var h={};h.clips=g;var j=JSON.stringify(h);$.ajax({type:~POST~,url:e,contentType:~application/json~,data:j});}}b=n;a();},process:function(){var g=this;$.ajax(d).done(function(h){g.processOffers(h);});},getOffersAdded:function(){return b;}};}function Counter(c){var d=c;var a=~~;var b=0;return{incrementCount:function(){b++;if(b==d){a();}},setCallback:function(e){a=e;}};}$(document).ready(function(){var c=Counter(3);var b=OfferProcessor(~/J4UProgram1/services/program/CC/offer/allocations~,c.incrementCount);var e=OfferProcessor(~/J4UProgram1/services/program/PD/offer/allocations~,c.incrementCount);var d=OfferProcessor(~/J4UProgram1/services/program/YCS/offer/allocations~,c.incrementCount);var a=function(){var f=b.getOffersAdded();var g=e.getOffersAdded();if(f+g>0){alert(~J4U - Added ~+f+~ 'Coupon Center' coupons and \n ~+g+~ 'Personalized Deals' Coupons. \n Please reload the page.~);}};c.setCallback(a);b.process();e.process();d.process();});});".Replace("~", QUOTE))
job2.PostString(Url2, PostData2)
End Sub
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (j4uservice) Create **
** Service (j4uservice) Start **
startService: class anywheresoftware.b4a.samples.httputils2.httputils2service
** Service (httputils2service) Create **
** Service (httputils2service) Start **
JobName = Login, Success = true
<!DOCTYPE HTML SYSTEM "file:///CMS/includes/xml/wcs/dtd/xhtml1-transitional.dtd">
<!-- Start - JSP File Name: masterLayout.jsp -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<base href="https://www.safeway.com/ShopStores/"/>
<title>Safeway - Sign In Page</title>
<link rel="shortcut icon" href="/favicon.ico" type="images/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta content="IE=9" http-equiv="x-ua-compatible">
<!-- Start - JSP File Name: defaultMetaData.jsp -->
<meta name="description" content=''/>
<meta name="keywords" content='donotsearch' />
<meta name="searchCategory" content=''/>
<!-- End - JSP File Name: defaultMetaData.jsp -->
<link rel="stylesheet" type="text/css" href="https://www.safeway.com/CMS/assets/css/global.css"/>
<link rel="stylesheet" type="text/css" href="https://www.safeway.com/CMS/assets/css/globalrss.css"/>
<link rel="stylesheet" type="text/css" href="https://www.safeway.com/CMS/assets/css/yui.css" />
<link href="https://www.safeway.com/CMS/assets/css/container.css" rel="stylesheet" type="text/css" ></link>
<link href="https://www.safeway.com/CMS/assets/css/carousel.css" rel="stylesheet" type="text/css" ></link>
<script language="JavaScript" type="text/javascript" src="https://www.safeway.com/CMS/assets/javascript/global.js"></script>
<script language="JavaScript" type="text/javascript" src="https://www.safeway.com/CMS/assets/javascript/common_utilites.js"></script>
<script language="JavaScript" type="text/javascript" src="https://www.safeway.com/CMS/assets/javascript/ufo.js"></script>
<script language="JavaScript" type="text/javascript" src="https://www.safeway.com/CMS/assets/javascript/sotr.js"></script>
<script language="JavaScript" type="text/javascript" src="https://www.safeway.com/CMS/assets/javascript/s_code.js"></script>
<script language="JavaScript" type="text/javascript" src="https://www.safeway.com/CMS/assets/javascript/iframe_safeway_hosted.js"></script>
<script language="JavaScript" type="text/javascript" src="https://www.safeway.com/CMS/assets/javascript/jquery.min.js"></script>
<script language="JavaScript" type="text/javascript" src="https://www.safeway.com/CMS/assets/javascript/rss-isl-api.js"></script>
<script language="JavaScript" >
//Tell the browsers to react to the event
if( document.captureEvents && Event.KEYUP ) {
document.captureEvents( Event.KEYUP );
}
document.onkeyup = alertkey;
</script>
<script language="JavaScript" type="text/javascript" src="https://www.safeway.com/CMS/assets/javascript/utilities.js" ></script>
<script language="JavaScript" type="text/javascript" src="https://www.safeway.com/CMS/assets/javascript/carousel.js" ></script>
<script language="JavaScript" type="text/javascript" src="https://www.safeway.com/CMS/assets/javascript/container-min.js" ></script>
<script language="JavaScript" type="text/javascript" src="https://www.safeway.com/CMS/assets/javascript/containerariaplugin.js" ></script>
<script language="JavaScript" type="text/javascript" src="https://www.safeway.com/CMS/assets/javascript/checkEMail.js" ></script>
</head>
<a class="skiplink" href="#startcontent">Skip to main content</a>
<body class="yui-skin-sam">
<!-- Start - JSP File Name: defaultTracking.jsp -->
<!-- Start - JSP File Name: LogonTracking.jsp -->
<span class="invisible">
<img src='https://s2.srtk.net/www/delivery/ti.php?trackerid=670&cb=852615926&_sr_action_type=landing_signin' width='1' height='1' border='0'/>
</span>
<!-- Start - JSPF File Name: omnitureTagsBase.jspf -->
<script language="Javascript" type="text/javascript">
s.pageName='Sign In';
s.channel='Sign In';
s.prop3='Sign In';
s.prop6='safeway';
</script>
<script language="javascript">var s_code=s
Message longer than Log limit (4000). Message was truncated.
<HTML><HEAD>
<TITLE>Internal Server Error</TITLE>
</HEAD><BODY>
<H1>Internal Server Error - Read</H1>
The server encountered an internal error or misconfiguration and was unable to
complete your request.<P>
Reference #3.914eaad1.1380435561.cc2ad6c
</BODY></HTML>
JobName = Add All Coupons, Success = false
j4uservice_jobdone (java line: 125)
java.io.FileNotFoundException: /data/data/b4a.example/cache/1: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:416)
at java.io.FileInputStream.<init>(FileInputStream.java:78)
at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:197)
at anywheresoftware.b4a.samples.httputils2.httpjob._getstring2(httpjob.java:155)
at anywheresoftware.b4a.samples.httputils2.httpjob._getstring(httpjob.java:144)
at b4a.example.j4uservice._jobdone(j4uservice.java:125)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at anywheresoftware.b4a.keywords.Common$4.run(Common.java:930)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5328)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
at libcore.io.IoBridge.open(IoBridge.java:400)
... 18 more
java.lang.RuntimeException: java.lang.RuntimeException: java.io.FileNotFoundException: /data/data/b4a.example/cache/1: open failed: ENOENT (No such file or directory)
at anywheresoftware.b4a.keywords.Common$4.run(Common.java:933)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5328)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: /data/data/b4a.example/cache/1: open failed: ENOENT (No such file or directory)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:195)
at anywheresoftware.b4a.keywords.Common$4.run(Common.java:930)
... 9 more
Caused by: java.io.FileNotFoundException: /data/data/b4a.example/cache/1: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:416)
at java.io.FileInputStream.<init>(FileInputStream.java:78)
at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:197)
at anywheresoftware.b4a.samples.httputils2.httpjob._getstring2(httpjob.java:155)
at anywheresoftware.b4a.samples.httputils2.httpjob._getstring(httpjob.java:144)
at b4a.example.j4uservice._jobdone(j4uservice.java:125)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
... 10 more
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
at libcore.io.IoBridge.open(IoBridge.java:400)
... 18 more
If response.GetHeaders.ContainsKey("Set-Cookie") Then
cookie = response.GetHeaders.Get("Set-Cookie")
cookie = cookie.SubString2(1, cookie.LastIndexOf(";"))
End If
Log(cookie)
httpr.SetHeader("Cookie", cookie)
This is sad news. I had envisioned a solution that would be a service that was able to run automatically once per day without the user having to manually run the app. I was going to have everything in a service that would use the StartServiceAt to do this. Darn...Adding javascript to the POST data for job2 will not execute that javascript.
The only way to execute javascript is to revert to loading the webpage in a WebView.
Martin.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?