How to Authenticate on a login page and be authenticated on application page


#1

Hello all,

still looking to resolve issue with dreamfactory javascript SDK
what i want to do

have a loging page for authentification : ok
based on example provided in SDK

window.app.login = function () {
        var body = {
            email: document.getElementById("email").value,
            password: document.getElementById("password").value
        };
        window.df.apis.user.login({body: body}, function (response) {
            //assign session token to be used for the session duration
            document.getElementById("login-status").innerHTML = "Logged In"
            window.authorizations.add("X-DreamFactory-Session-Token", new ApiKeyAuthorization("X-Dreamfactory-Session-Token", response.session_id, 'header'));
        }, function(response){
            document.getElementById("login-status").innerHTML = window.app.getErrorString(response);
        });
    };

    window.app.logout = function () {
        window.df.apis.user.logout(null, function (response) {
            document.getElementById("login-status").innerHTML = "Logged Out"
        }, function(response){
            document.getElementById("login-status").innerHTML = window.app.getErrorString(response);
        });
    };

what i want to do is, when i wass authentified to jump to my home page (dashboard.html) where i can run query and be authentificated.

my problem is when i go from login page to dashboard page i lost the authentification
is there a way to pass session id from login.html to dashboard.html

or something else?

thanks in advance for your help

julien


#4

Hi @jeebee, this sounds a lot like your other thread here. What makes this thread a separate issue instead of a continuation of the other thread?


#5