FaceboookDesktop user stays logged in after I call FaceboookDesktop.logout - actionscript-3

Having the same issue as this user
As3 Graph API Logout
and this user
Facebook Kiosk Logout
Using the AS3 FacebookDesktop SDK for an AIR desktop based kiosk application
http://facebook-actionscript-api.googlecode.com/svn/release/current/docs/com/facebook/graph/FacebookDesktop.html
I can login, upload successfully.
Additionally when I call
FacebookDesktop.logout(handleLogout, APP_ORIGIN)
the response object returned in handleLogout = success
I have also defined APP_ORIGIN to = the same url associated with my APP_ID.
and set FacebookDesktop.manageSession = false
The problem is the user stays logged in after I upload and I need to log them out automatically after each upload.
This solution suggests targeting logout.php passing the ACCESS TOKEN.
https://stackoverflow.com/questions/7771821/log-out-from-facebook
But I don't have an access token, only a user ID.
Can anyone suggest a solution that works with an AIR desktop application?

see this thread
https://code.google.com/p/facebook-actionscript-api/issues/detail?id=206
'I had this problem and i solved using this workaround, you have to
download the source code of the 1.7 dist. Then open the
FacebookDesktop.as file and look for the logout function (not the
static one), then find the value 'params.next =
"http://static.ak.fbcdn.net/connect/xd_proxy.php#origin="+(appOrigin?appOrigin:"")'
and change it to 'params.next = "http://www.facebook.com/"'.

Related

VimeoUpload not re-authenticating After Deletion of App Access on Vimeo.com

I was able to connect and upload videos using the library but when I deleted the app connection on Vimeo.com (as a test) the app didn't authorize again.
the upload looks like it's working but nothing is uploaded as the app is no longer connected.
I deleted the app on the phone and restarted but it still won't re-authorize the app.
This comes up in the output:
Vimeo upload state : Executing
Vimeo upload state : Finished
Invalid http status code for download task.
And this is in OldVimeoUpload.swift: ( didn't include the actual access code!)
import Foundation
class OldVimeoUpload: VimeoUpload
{
static var VIMEO_ACCESS_TOKEN :String! // = "there's a string of numbers here"
static let sharedInstance = OldVimeoUpload(backgroundSessionIdentifier: "") { () -> String? in
return VIMEO_ACCESS_TOKEN // See README for details on how to obtain and OAuth token
}
// MARK: - Initialization
override init(backgroundSessionIdentifier: String, authTokenBlock: AuthTokenBlock)
{
super.init(backgroundSessionIdentifier: backgroundSessionIdentifier, authTokenBlock: authTokenBlock)
}
}
It looks like the access token number is commented out. I deleted the 2 forward slashes to see if that would fix it but it didn't.
I spoke too soon.
It sounds like you went to developer.vimeo.com and created an auth token. Used it to upload videos. And then went back to developer.vimeo.com and deleted the auth token.
The app / VimeoUpload will not automatically re-authenticated in this situation. You've killed the token and the app cannot request a new one for you. You'll need to create a new auth token and plug it into the app.
If this is not accurate and you're describing a different issue let us know.
If you inspect the error that's thrown from the failing request I'm guessing you'll see it's a 401 unauthorized related to using an invalid token.
Edit:
Disconnecting your app (as described in your comment below) has the same effect as deleting your auth token from developer.vimeo.com.
Also, VimeoUpload accepts a hardcoded auth token (as you see from the README and your code sample). It will not automatically re-authenticate, probably ever.
If you'd like to handle authentication in your app check out VimeoNetworking or VIMNetworking. Either of those libraries can be used to create a variety of authentication flows / scenarios. Still, if a logged in user disconnects or deletes their token, you will need them to deliberately re-authenticate (i.e. you will need to build that flow yourself). In that case, the user has explicitly stated that they don't want the app to be able to access information on their behalf. It would go against our security contract with them to automatically re-authenticate somehow.
Does that make sense?

Flash UrlLoader - prevent or suppress authentication dialog box

I have a rssfeed application made in Adobe AIR. It uses the UrlLoader to read the feeds. I need the application to never prompt the user to enter password for a website or accept a certificate of a website if is no longer valid. I prefer to have it fail instead.
I have setup the event listeners for IO+Error and Security_ERROR but that is not enough
Sample urls(this may not work in future)
http://www.dawnanddrew.com/rss2.xml (asks for user and pass atm)
I had another issue with a feed that even if it was a http url the website redirected the loader to https and then the certificate validation failed and the user was asked to accept the certificate. I need this to fail (I mark failed feeds and the user can check them when they want to find the issue and fix them or remove them)
Using AIR (which you are), you can actually tell the application to NOT handle authentication.
var request:URLRequest =new URLRequest("http://www.dawnanddrew.com/rss2.xml");
request.authenticate = false; //default is true, so you need to tell your request to not handle authentication
Then it will fail with an IO error instead of prompting for credentials.
Documentation
Note however, this will only work in AIR and is not a supported property for flash player.
You cannot do it this way. Now, the server returns specific status and the browser reacts to it by showing you a login dialog box. You cannot do this directly in flash and you cannot get default login button. You need to implement this by your own. The perfect way to do so is to check (server side) if the user is logged in and if not - return status ok (200) with an error message (let's say JSON). This specific message would be read by the flash client and a login screen would be shown (custom made). You will also need to implement the login feature by yourself :)
Sorry for the bad news, but this is the way it is with flash.

Windows Phone Custom URI

in my windows phone 8 application i am using custom uri association to launch another application through my phone.
i.e
await Windows.System.Launcher.LaunchUriAsync(new Uri("sixtag:"));
but my app is not able to get certified for store because of this. the testing team tells that you app terminates unexpectedly while executing this.
now, i don't know how to deal with this.
is there any way to throw exception if the app which i am launching is not installed on phone ?
or i should try something else so my task gets accomplished and app gets certified for store as well.
You do not need to wrap your launch in try/catch or check for success as described in the other answers. As soon as you call LaunchUriAsync, the platform takes over and will automatically handle the possibility of no app being installed by asking the user if she wishes to search in the store.
A couple of things to double-check:
1) Ensure that you can successfully back into your app following the navigation to sixtag.
2) Ensure that your call to LaunchUriAsync is the direct result of a user action (eg. tapping a button)
try
{
await Windows.System.Launcher.LaunchUriAsync(new Uri("sixtag:"));
}
catch
{
MessageBox.Show("please install Sixtag from the app store","AppMissing", MessageBoxButton.OK);
}
you can perhaps display another button and on clicking directly navigate to the app store. See if this solves your problem. Do vote it up if it does :)
You are needed to handle that as shown here . Also Read out Remarks given there.

How to clear AIR cache for working Facebook logout?

I am developing an AIR application that is supposed to run on desktop and mobile platforms.
For most Facebook functionality, I use the official GraphAPI for Flash, version 1.8.1.
To use the app, the user must login to Facebook, this works easily by first calling FacebookMobile.init(), and if it reports that the user is not logged in, logging in like this:
var webView :StageWebView = new StageWebView();
webView.stage = stage;
webView.viewPort = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);
FacebookMobile.login(handleLoginResult, stage, new Array(), webView);
All of this works very well, but logging out does not work as expected. Calling
FacebookMobile.logout(handleLogout);
does log out the user from Facebook, it seems, and handleLogout is always passed a true as first parameter. After this logout, when FacebookMobile.init() is called, it also correctly reports the user as not logged in. So I call the login() method from above again.
Then, the WebView opens, but closes itself immediatly, automatically logging in the user that just logged out, without showing any kind of Facebook login screen. But I want to be able to log in another user, by having to type in email and passwort.
Probably I should mention that the logging out happens when the application starts. The user can't log out himself, the application does so when starting, so that the user should be forced to login each time. Yes, this has a reason ;)
I'm sure this is some kind of caching problem, but how can I solve it with Flash/AIR?
Bit late but better than nothing right? I have seen this issue before when I was experimenting with the OAUTH api...
Found the potential solution while looking for a separate issue but with regards to caching/cookies...
This post explains what you need to do:
http://cookbooks.adobe.com/post_Cannot_logout_from_Facebook_on_Android_devices-19254.html
Basically its not a very pretty solution, but what it does is you manually delete the folders where the caching is happening.
Hope this helps.
Implementing "reallyLogout" from this answer for a similar issue worked for me:
https://stackoverflow.com/a/8199505/952779
Clear internet explorer cache & cookies, .. and it will log you out from StageWebView facebook login
UPDATE: Change also the app id from the descriptor xml file

How can I enable the file upload permission?

I'm trying to upload images generated in my Flash application to an album on Facebook. This was working earlier in the year, but revisiting the code I now get the following OAuthException:
(#324) Requires upload file
I am using the most recent version of the ActionSccript Facebook API. The setup works like this:
First I do the authentication check with PHP to ensure users have granted permission before having to wait for the Flash to load. I'm requesting the publish_stream and user_photos permissions. The access token comes back correctly.
Once the user is authenticated the Flash is loaded and performs its own initialisation, passing fileUpload=true as part of the init object:
var initObject:Object = {
channelUrl : "myChannelURL.html",
fileUpload : true
}
Facebook.init(
'myAppID',
myCallbackFunction,
initObject,
myAccessToken
);
This seems to work as expected, the callback receives the uid of the current user.
At the end of my application I POST a Bitmap object to a predetermined album:
Facebook.api(
albumID+"/photos",
onImagePost,
{
message:"",
image:new Bitmap(myBitmapData),
fileName:''
},
URLRequestMethod.POST
);
At this point Facebook returns a 400 response:
"error": {
"message": "(#324) Requires upload file",
"type": "OAuthException"
}
What more do I need to do to ensure that this permission is being included?
It turns out that this was not a permissions error at all. Since I last deployed this code Facebook have tightened up their restrictions a bit, and the fileName parameter passed as part of the api call can no longer be an empty string. Simply passing any old text as a file name fixes the problem.
Facebook.api(
albumID+"/photos",
onImagePost,
{
message:"",
image:new Bitmap(myBitmapData),
fileName:'FILE' // required to be non-empty
},
URLRequestMethod.POST
);
Im not sure if this is a solution that can be translated into the Actionscript SDK... But, with the PHP SDK there is a method inside the facebook SDK that is called setFileUploadSupport - try looking in the code for a place to set that parameter to true.