We’ve migrated our documentation to a new site, which means some URLs have changed. If you hit a broken link, submit a support ticket.
Subscriptions

How to get user data such as email or name from the Piano SDK

You can obtain user data using the JWT token with the Piano PHP SDK and the mobile SDK. Individual SDK libraries are available here.

The JWT is stored in the __utp cookie. In the browser, read __utp from document.cookie and decode its payload (base64) as in the example below:

atob(utpCookieValue.split('.' )[1]);

This returns the JWT claims as a JavaScript object.

In PHP, read the cookie from $_COOKIE['__utp']. First-party cookies are sent with backend requests.

For the mobile SDK, decrypt the JWT to obtain the user details.

Last updated: