Search results

Embed data source with token in Bold BI

Bold BI supports embedding the data source into other web applications using Token authentication.

Steps to embed data source

The following steps outline how to embed a data source into other web applications.

Get embed secret code

  1. Go to the settings page and click on Embed. Enable the Enable embed authentication under that page.

    Enable embed authentication

  2. Click Generate Secret button.

    Generate secret code

  3. When you click on it, the secret code will be generated. Be sure to save the secret key securely as it cannot be retrieved or restored once the secret is generated.

    Copy secret code

  4. After generating the secret code, it can be regenerated by clicking the Regenerate Secret button.

    Regenerate secret code

Warning : Resetting this code will cause the previously functioning embedded dashboards to stop working.

Creating the embed URL to create data source

The embed URL should be in the following format; to get create datasource URl, Please refer the Get Data source URL.

{create datasource URL}/{embed parameters}&embed_signature={signature}

Example: http://test.boldbi.com/bi/en-us/site/site1/datasource-designer/connection?embed_nonce=3e253410-1a82-4fb3-a337-122a8007dafc&embed_user_email=test@syncfusion.com&embeds=sdwd&embed_timestamp=1583928213&embed_signature=VYrDMVX4h85PrRBKX9mystRHYkU8z+HVC9bkVMc2qGY='

Please find the details of the parameter in the URL as follows.

Parameter Description
create datasource URL URL of the data source to establish a new connection. To know more, click the Get Data source URL.
embed parameters Parameters required to embed the data source with Token.
signature The authorized key for the data source to be embedded in create mode.

Creating the embed URL to edit data source

The embed URL should be in the following format; to get edit datasource URL, please refer the Get Data source URL.

{edit datasource URL}/{embed parameters}&embed_signature={signature}

Example: http://test.boldbi.com/bi/en-us/site/site1/datasource-designer/8428c9d9-85db-418c-b877-ea4495dcddd7/Personal%20Expense%20Analysis?embed_nonce=3e253410-1a82-4fb3-a337-122a8007dafc&embed_user_email=test@syncfusion.com&embeds=sdwd&embed_timestamp=1583928213&embed_signature=VYrDMVX4h85PrRBKX9mystRHYkU8z+HVC9bkVMc2qGY='

Please find the details of the parameter in the URL as follows.

Parameter Description
edit datasource URL URL of the data source to be embedded. To know more, click theGet Data source URL.
embed parameters Parameters required to embed the data source with Token.
signature The authorized key for the data source to be embedded in design mode.

Parameters to generate the signature in the embed URL

The following values are necessary to form the signature.

Parameter Description Example
embed_nonce Random string that restricts the URL reconstruction or attacks from the hackers. 0fa8d95d-e262-4a89-0976-390e3a57ee50
embed_user_email The email id of the user. test@syncfusion.com
embed_timestamp The current time as UNIX time stamp. The embed URL formed is valid for 604800 sec(7 days as maximum) from this embed time stamp. Example for embed_timestamp is 1583934776.

Generating the signature for the embed URL

Parameter Description Example
embed_signature A signature generated using the secret code to authenticate the embed URL. VYrDMVX4h85PrRBKX9mystRHYkU8z+HVC9bkVMc2qGY=

The embed parameter should be formed as in the below format.

embed_nonce=55a1c8f4-5015-487d-8463-d3ebeae655fd&embed_user_email=test@syncfusion.com&embed_timestamp=1583935418

To obtain the signature for the embed URL, you need to pass the query parameters as an argument to the GetSignatureUrl method. This method will return the hashed signature, which you should append to the existing query parameters using the query parameter name ‘embed_signature’.

        
        public string GetSignatureUrl(string queryString)
        {
            // Get the embedSecret key from Bold BI.
            var embedSecret = "8apLLNabQisvriG2W1nOI7XWkl2CsYY";
            var encoding = new System.Text.UTF8Encoding();
            var keyBytes = encoding.GetBytes(embedSecret);
            var messageBytes = encoding.GetBytes(queryString);
            using (var hmacsha1 = new HMACSHA256(keyBytes))
            {
                var hashMessage = hmacsha1.ComputeHash(messageBytes);
                return Convert.ToBase64String(hashMessage);
            }
        }

Please find below the code sample to generate the signature in C#. You can write the equivalent code in your preferred programming language.

Sample to embed data source in edit mode using Token authentication

You can download the sample.