Passing Data
How To: Retrieve User Data on Different Devices
Resuming a user’s progress after remarketing to them by email or SMS
This guide explains how to implement user session recovery when users access your application from a different device, typically through email or SMS remarketing campaigns.
Overview
To securely allow users to resume their session on a different device, you’ll need to:
- Generate a Hashed Token, which is generated from the user’s Entry ID, an expiration timestamp, and a Secret Key.
- Send users a secure URL that contains this Hashed Token, as well as the user’s Entry ID and the expiration timestamp.
- When a user opens the URL, use the Hashed Token and other parameters to securely call the Embeddables API from the client, which will return the User Data.
- Use this retrieved User Data to restore the user’s session.
Generating the Hashed Tokens and secure URLs
To generate a Hashed Token and secure URL, you’ll need a Secret Key - contact Embeddables Support to get this Secret Key.
Here’s how to generate the Hashed Token and secure URL:
Client-Side Implementation
Once the user clicks the generated URL, create a Action, triggered on Embeddable Load, with the following code to fetch and restore their session:
Important Notes
- The secret key should always be stored as an encrypted backend environment variable and never exposed in client-side code.
- Each URL should have a reasonable expiration time, e.g. 7 days or 30 days.
- The Hashed Token is unique per user and expiration date.
Troubleshooting
If you’re experiencing issues:
- Verify that the secret key is correctly set in your environment variables
- Ensure the expiration timestamp is in the correct ISO format
- Check that all URL parameters (token, entry_id, expires_at) are properly encoded
- Confirm that the necessary permissions are enabled for your application
Was this page helpful?