Hi All,
Have made some progess in getting the API to work in PowerShell, but I don't seem to be able to get the confirmation part to work. I think it might be my Cookies but since PowerShell takes care of that in web sessions I cannot figure out what I am doing wrong.
What I have so far working:
From here, $wrLogin.BaseResponse indicates I need to confirm, and I'm getting the confirmation email with a code, so from there I do
The $wrConfirm.BaseResponse indicates I am still on the Confirm page - I have not been redirected back to the login page.
My cookiejar in $orerve still has a domain session cookie as well.
I have no reason not to believe this has not worked, but also no real way to confirm
Then I try
My base response now seems to indicate that I have been redirected back to the Login page, and I have no JSON data. So the API does not think I have logged in. So either I'm not doing something right on the confirm page, or my WebSession is not working as it should be.
If anyone is able to help I'd appreciate it
Have made some progess in getting the API to work in PowerShell, but I don't seem to be able to get the confirmation part to work. I think it might be my Cookies but since PowerShell takes care of that in web sessions I cannot figure out what I am doing wrong.
What I have so far working:
Code:
$uriLogin = "https://companion.orerve.net/user/login"
$uriConfirm = "https://companion.orerve.net/user/confirm"
$uriProfile = "https://companion.orerve.net/profile"
$ua = "Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Mobile/11D257"
$postParams = @{email='email@address.com';password='password'}
$wrLogin = invoke-webrequest -uri $uriLogin -useragent $ua -SessionVariable orerve -method post -body $postParams
From here, $wrLogin.BaseResponse indicates I need to confirm, and I'm getting the confirmation email with a code, so from there I do
Code:
$code = @{code='ABCDE'}
$wrConfirm = Invoke-WebRequest -uri $uriConfirm -UserAgent $ua -WebSession $orerve -Method Post -Body $code
The $wrConfirm.BaseResponse indicates I am still on the Confirm page - I have not been redirected back to the login page.
My cookiejar in $orerve still has a domain session cookie as well.
I have no reason not to believe this has not worked, but also no real way to confirm
Then I try
Code:
$wrProfile = Invoke-webrequest -uri $uriProfile -userAgent $ua -websession $orerve -method Get
My base response now seems to indicate that I have been redirected back to the Login page, and I have no JSON data. So the API does not think I have logged in. So either I'm not doing something right on the confirm page, or my WebSession is not working as it should be.
If anyone is able to help I'd appreciate it
Last edited: