SHA1 replaced with SHA256 for the Storefront SSO feature

What's new

The encryption mechanism for SSO was updated from SHA1 to SHA256 for security enhancement.

SSO (Single-Sign-On) for websites

Changes in API

Payload signing now uses sha256. Code example on PHP:

<?php
    $client_secret = "A1Lu7ANIhKD6A1Lu7ANIhKD6ADsaSdsa"; // example value
    $message = base64_encode("{appClientId: 'my-cool-app', userId:'234', profile: { email:'[email protected]', billingPerson: { name: 'John Doe' } }}"); // example values
    $timestamp = time();
    $hmac = hash_hmac('sha256', "$message $timestamp", $client_secret);

    echo "<script> var ecwid_sso_profile = '$message $hmac $timestamp'; </script>";
?>

Why the changes are breaking

The SHA1 encryption is now discontinued. If the encryption mechanism isn't updated in the code, the SSO will stop working.

How to update the app

  1. Check if your app uses SSO on the website.

  2. Check the code to find the hash_hmac() encryption.

  3. Update the 'sha1' with 'sha256' inside the hash_hmac() method.

Last updated

Was this helpful?