You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using OAuth-js to share images on Facebook and Twitter.
However, I am running into an issue where forcing clearCache and cache: false doesn't seem to force users to re-login.
Ideally this is the flow am after:
user clicks share
logs into twitter/facebook
image is shared
user goes back to start
user clicks share
user has to log in again to share
See code below. I force both but the credientails are still retained once the user authenticates. Is this correct behaviour or have i placed the calls in the wrong place? (Code is exact to my working version but stripped of app specific messaging to the UI)
Thanks.
// initialize OAuth
OAuth.initialize('XXXXXXXXXXX');
// clear any previous logins
OAuth.clearCache();
// logining into twitter
OAuth.popup("twitter", {cache:false}).then(function(twitter) {
console.log("twitter", twitter);
var formData = new FormData();
// add the source of the image (needs to be raw binary with type added)
formData.append('media', Utils.getBlob(image));
// upload image to get media id
twitter.post('https://upload.twitter.com/1.1/media/upload.json',{
data: formData,
cache:false,
processData: false,
contentType: false
}).done(function(uploadResult){
console.log("uploaded media asset to twitter ",uploadResult);
// use media ID to post to user wall
twitter.post('/1.1/statuses/update.json',{
data:{
status:message,
media_ids:uploadResult.media_id_string
}
}).done(function(postResult){
console.log("posted to twitter ", postResult);
if(postResult.id){
console.log("successful submission to twitter");
}else{
app.showErrorPost();
}
}).fail(function(postFail){
console.log("post to twitter fail ",postFail.responseText);
});
}).fail(function(uploadfail){
console.log("failed to upload media asset ",uploadfail.responseText);
});
}).done(function(loginResult){
console.log("successful twitter auth ",loginResult);
}).fail(function(loginFail){
// if the user denies log in
console.log("failed twitter auth ",loginFail.responseText);
});
The text was updated successfully, but these errors were encountered:
any update to this issue, these options do not work for me as well, in case cached credentials are no longer valid you'll be given the error without any option to relogin, that's extremely annoying, we're thinking to move to other solutions instead :(
I am using OAuth-js to share images on Facebook and Twitter.
However, I am running into an issue where forcing clearCache and cache: false doesn't seem to force users to re-login.
Ideally this is the flow am after:
See code below. I force both but the credientails are still retained once the user authenticates. Is this correct behaviour or have i placed the calls in the wrong place? (Code is exact to my working version but stripped of app specific messaging to the UI)
Thanks.
The text was updated successfully, but these errors were encountered: