web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : wUU0OZw5nvdzXEu8Xo4UZS
Power Automate - Building Flows
Answered

From PHP example to FLOW

Like (0) ShareShare
ReportReport
Posted on 18 Sep 2019 12:40:36 by 67

Hi All,

 

Very new here, but I hope some one with good flow experience can help me out...
We want to connect to an api from a vendor, this vendor requires a very special way to create an auth token.
As an example, they provided the following php code, which I tested and works.
I do however want to connect with flow, and the main thing is , how do I construct the authtoken in flow ?

 

Below is the PHP code example , the public and private key are changed for security reasons.

What I did as a first test was to put all these things into variables, but I have most problems in how to consruct things in flow liked "hashedstring" and "hash"

Any suggestions ?

<?php
function GetAuthToken() {
$public_key = 'sMmBvUcJcMj6fh4tLz9ysnG7';
$private_key = 'JYt78NJGK2XP3UZbG4f6RtVe';
$company_key = 'DTP@PI';
$administration = 1;
$user_id = 2000000;
$timestamp = time();

$secret_key_byte_array = base64_decode($private_key);

$nonce = base64_encode($private_key.$timestamp);
$hashedstring = $public_key.$company_key.'GET'.$timestamp.$nonce;
$hash = base64_encode(hash_hmac('sha256', $hashedstring, $secret_key_byte_array, true));

$authToken = "{$public_key}:{$company_key}:{$hash}:{$nonce}:{$timestamp}:{$administration}:{$user_id}";

return $authToken;
}

function GetWebShopUserTypes() {
$client = new GuzzleHttp\Client([
'headers'=> [
'X-LOGIC4-Authorization' => GetAuthToken()
]
]);

$response = $client->request('GET', 'https://api.logic4.nl/Webshop/GetWebShopUserTypes');

var_dump((string)$response->getBody());

}

GetWebShopUserTypes();

?>

  • Vinisz Profile Picture
    67 on 18 Sep 2019 at 14:24:57
    Re: From PHP example to FLOW

    Was already looking that way and have it working now, thanks !

  • Verified answer
    PieterVeenstra Profile Picture
    2 on 18 Sep 2019 at 14:10:33
    Re: From PHP example to FLOW

    Hi @Vinisz ,

     

    I would look into Azure functions if you really want to replicate that same functionality. Then from flow you can call the azure function.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2