cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Stefanovic83
Frequent Visitor

Get Cookie from login on website E-boekhouden.nl

I'm building a flow to push worked hours to the bookkeeping system. 

For authentification, I need to get the cookie I receive after logging in on the website. 

 

 

 

In Chrome Inspect, Network tab, I see the following:

I need to fetch the string after the second "set-cookie". Where I wrote CookiestringIneed

 

How can I fetch it and convert it in a Variable?

 

 

Request URL: https://secure.e-boekhouden.nl/bh/inloggen.asp?LOGIN=1&EBM=
Request Method: POST
Status Code: 200 OK
Remote Address: 213.206.235.230:443
Referrer Policy: same-origin
access-control-allow-origin: *
cache-control: private
content-length: 10341
content-security-policy: default-src https: wss: data: blob: mailto: 'unsafe-inline' 'unsafe-eval' *.e-boekhouden.nl; img-src http: https: data:;frame-ancestors *.e-boekhouden.nl
content-type: text/html; Charset=ISO-8859-1
date: Thu, 30 Jun 2022 10:08:21 GMT
expires: Fri, 31 Dec 1999 23:00:00 GMT
pragma: no-cache
referrer-policy: same-origin
server: EBSrv
set-cookie: Adm=|144220; Path=/;; HttpOnly; Secure; SameSite=Lax
set-cookie: CookiestringIneed
set-cookie: privatestring; expires=Thu, 30-Jun-2022 12:08:20 GMT; path=/; HttpOnly; Secure; SameSite=Lax
strict-transport-security: max-age=31536000;includeSubDomains;preload
x-content-type-options: nosniff
x-xss-protection: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate, br
Accept-Language: nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7
Cache-Control: max-age=0
Connection: keep-alive
Content-Length: 133
Content-Type: application/x-www-form-urlencoded
Cookie: don't need this
DNT: 1
Host: secure.e-boekhouden.nl
Origin: https://secure.e-boekhouden.nl
Referer: https://secure.e-boekhouden.nl/bh/inloggen.asp
sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="102", "Google Chrome";v="102"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Sec-Fetch-Dest: frame
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36

 

 

 

1 REPLY 1
Stefanovic83
Frequent Visitor

Nobody with an answer?

 

If it helps.. I found a C# code that works with the one who posted it. I don't know how to use that in Power Automate

 

C#:

static async Task<string> GetLoginCookie(string userName, string password)
{
    var client = new HttpClient();
    var loginPage = await client.GetStringAsync("https://secure.e-boekhouden.nl/bh/inloggen.asp?EBM=");

    var document = new HtmlDocument();
    document.LoadHtml(loginPage);

    var result = await client.PostAsync("https://secure.e-boekhouden.nl/bh/inloggen.asp?LOGIN=1&EBM=",
        new FormUrlEncodedContent(new Dictionary<string, string>
        {
            { "txtEmail", userName },
            { "txtWachtwoord", password },
            { "txtFormCheck", document.GetElementbyId("txtFormCheck").GetAttributeValue("value", "") },
            { "FP", document.GetElementbyId("FP").GetAttributeValue("value", "") },
            { "XSRVX", document.GetElementbyId("XSRVX").GetAttributeValue("value", "") },
        }));

    return result.Headers.Where(x => x.Key == "Set-Cookie").SelectMany(x => x.Value)
        .Where(x => x.StartsWith("auth-token")).Select(x => x.Split(";").FirstOrDefault()).FirstOrDefault();
}

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,712)