Base64 Encoding for Special Characters

Our standard embed code works for a majority of customers, but there may be a special-case need that you have which may require Base64 encoding.

First, you will need to ensure that all of your values are base64 encoded.

Original token:

token: "&avatarFull=http://c.api.stage.userplane.com/sandbox/avatar-icon.jpg&avatarIcon=http://c.api.stage.userplane.com/sandbox/avatar-icon.jpg&avatarThumb=http://c.api.stage.userplane.com/sandbox/avatar-icon.jpg&displayName=Winston&email=user@email.com&line1=25&line2=Male&line3=Santa Monica&line4=CA&ts=1305906667528&userId=1&token=7E5D5F3B7647A325368F7188F5DEA30F"

You will need to perform a base64 function on each of the values after the equal sign, so your result would look something similar to this:

token: "&avatarFull=aHR0cDovL2MuYXBpLnN0YWdlLnVzZXJwbGFuZS5jb20vc2FuZGJveC9hdmF0YXItaWNvbi5qcGc=&avatarIcon=aHR0cDovL2MuYXBpLnN0YWdlLnVzZXJwbGFuZS5jb20vc2FuZGJveC9hdmF0YXItaWNvbi5qcGc=&avatarThumb=aHR0cDovL2MuYXBpLnN0YWdlLnVzZXJwbGFuZS5jb20vc2FuZGJveC9hdmF0YXItaWNvbi5qcGc=&displayName=V2luc3Rvbg==&email=dXNlckBlbWFpbC5jb20=&line1=MjU=&line2=TWFsZQ==&line3=U2FudGEgTW9uaWNh&line4=Q0E=&ts=MTMwNTkwNjY2NzUyOA==&userId=MQ==&token=7E5D5F3B7647A325368F7188F5DEA30F"

You will see that every property has been Base64′d, except for the token property. That is the one property that needs to remain as its original value.

Lastly, you’ll need to add tokenType with the value of Base64 to the settings, as seen below.

// Example of adding tokenType and Base64 to your settings.
up.init({
      siteId:"YOUR_SITE_ID",
      key: "",
      token: "YOUR_TOKEN_IDENTIFIER",
      settings: {
          tokenType: "Base64"
      },
      lang: "en-us"
   });

If you need help encoding, here is a useful Base64 Encoder/Decoder.