ngDropbox icon indicating copy to clipboard operation
ngDropbox copied to clipboard

Remember me option

Open leonzinger opened this issue 10 years ago • 3 comments

Hi Christian, Do you think it is possible to add this option when user authenticates, so that the user will stay "signed in" even after page reload

leonzinger avatar Jan 02 '14 15:01 leonzinger

Great question. There are a number of ways to handle this depending on your app architecture and security requirements. Whatever improvements we make need to preserve flexibility on both counts. Planning to spend some time on this repo in the near future. I'll be sure to give it some thought.

christiansmith avatar Jan 02 '14 15:01 christiansmith

I quickly hacked something together with localStorage. It won't work with older browsers of course. Here's my solution:

var checkAuthenticated = function () {
        if (localStorage['dropbox.oauth']) {
            var oauth = angular.fromJson(localStorage['ngDropbox.oauth']);
            Dropbox.setCredentials(oauth);
            return true;
        } else {
            return false;
        }
}
Dropbox.authenticate().then(function (oauth) {
        if(oauth.uid){
            localStorage['ngDropbox.oauth'] = angular.toJson(oauth);
        }
});

thrashr888 avatar Jan 04 '14 17:01 thrashr888

Great, thanks a lot thrashr888 On Jan 4, 2014 7:08 PM, "Paul Thrasher" [email protected] wrote:

I quickly hacked something together with localStorage. It won't work with older browsers of course. Here's my solution:

var checkAuthenticated = function () { if (localStorage['dropbox.oauth']) { var oauth = angular.fromJson(localStorage['ngDropbox.oauth']); Dropbox.setCredentials(oauth); return true; } else { return false; } } Dropbox.authenticate().then(function (oauth) { if(oauth.uid){ localStorage['ngDropbox.oauth'] = angular.toJson(oauth); } });

— Reply to this email directly or view it on GitHubhttps://github.com/christiansmith/ngDropbox/issues/1#issuecomment-31583136 .

leonzinger avatar Jan 04 '14 17:01 leonzinger