How to integrate tableau dashboards in a android application (java)?

62 Views Asked by At

I want to integrate some tableau dashboards in my android application. for that I have utilized its JavaScript API and JWT token using JS, in which basically I bypassed the login page to let my customers sees dashboards without authenticating under Tableau's viewers license, When I test my code, it runs fine on web but not on android. On android it asks for authorization again. Even I Tried to put that dashboard on live flask server and then load it using URL only. then also it asks for authorization. kindly suggest or guide any way to do it.

<!doctype html>
<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script type="module" src="https://prod-apnortheast-a.online.tableau.com/javascripts/api/tableau.embedding.3.latest.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            var userid = '[email protected]';
            $.ajax({
                type: "GET",
                url: "url where my token is generated",
                data: { userid: userid },
                dataType: "text",
                success: function(tokenValue) {
                    tableauDashLogin(tokenValue);
                    setTimeout(function() {
                        tableauDashLogin(tokenValue);
                    }, 2000);
                },
                error: function(error) {
                    console.error(error);
                }
            });
        });

        function tableauDashLogin(tokenValue) {
            const tableauViz = document.createElement('tableau-viz');
            tableauViz.id = 'tableau-viz';
            tableauViz.src = 'dashboards_url';
            tableauViz.token = tokenValue;
            tableauViz.width = '100%';
            tableauViz.height = '900';
            tableauViz.hideTabs = true;
            tableauViz.toolbar = 'bottom';
            tableauViz.frameborder = '1';
            document.body.appendChild(tableauViz);
            console.log(combinedOutput);
            console.log(tableauViz.token);
        }
    </script>
</head>
<body>
</body>
</html>


Second code:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Tableau Embedding Example</title>

    <script type='module'
        src='https://prod-apnortheast-a.online.tableau.com/javascripts/api/tableau.embedding.3.latest.min.js'></script>
    <tableau-viz id='tableau-viz'
        src='dashboards_url'
        token='my_jwt_token'
        frameborder="1"></tableau-viz>
</head>
<body>
</body>
</html>

I have tried achieving it using webview, interface, fragments etc. on android but none is working. Custom Chrome Tab is working but it opens it in browser not on my android screen. I am suspecting that Tableau is not allowing access through android applications. Is it possible that tableau detects that it is a android application request not a web request, And hence not providing access?

0

There are 0 best solutions below