ngDropbox
ngDropbox copied to clipboard
Remember me option
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
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.
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);
}
});
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 .