Facebook login WinJS Store app issues - facebook

I tried following this blog post
Which explains how to setup up facebook login on a WinJS app.
I got it all working, got the app ids set and the authentication dialog is showing the correct app name and authentication stuff, however when the app redirects the app receives this error (after closing the dialog: "The specified protocol is unknown") and the dialog shows the error message: "We can't connect to the service you need right now. Check your network connection or try this again later".
the error stack:
"WinRTError: The specified protocol is unknown.\r\n\n at getResultsOfAsyncOp (Function code:338:5)\n at op.completed (Function code:427:21)
Actual calling code:
var loginURL = "https://www.facebook.com/dialog/oauth?client_id=[snip]&display=popup&scope=user_about_me&response_type=token&redirect_uri=ms-app://s-[snip]/"
Windows.Security.Authentication.Web.WebAuthenticationBroker.authenticateAsync(
Windows.Security.Authentication.Web.WebAuthenticationOptions.none,
new Windows.Foundation.Uri(loginURL))
.then(function success(result) {
}, function error(error) {
});
Hopefully anyone here has any idea why this error message is thrown.

We managed to solve the issue.
The sid from the store was different from the sid of the app during local debugging. By changing the appmanifest -> packaging -> publisher certificate to a local certificate with the CN provided in the store settings the sid is updated to be equal to the one in the store.
et voila, it works.

Related

Invoking error handler due to Uncaught abort(59) at Error. How can I solve this?

So I am trying to create a Unity game for WebGl. In this game I need auth0 for the authentication part.
This is the code for the authentication part:
var client = new AuthenticationApiClient(new System.Uri("..."));
var authorizationUrl = client.BuildAuthorizationUrl()
.WithResponseType(AuthorizationResponseType.IdToken, AuthorizationResponseType.Token)
.WithClient("...")
.WithConnection("...")
.WithAudience("...")
.WithRedirectUrl("...")
.Build();
Application.OpenURL(authorizationUrl.AbsolutePath);
To make my page work I have a local server in XAMPP.
So the idea with this is that I need to click a button on the game redirect the page to an Auth0 authentication page and once I enter my username and password (for example gmail account) I go to the game again.
The problem is that whenever I click in this button, I get this error:
Invoking error handler due to
Uncaught abort(59) at Error
at jsStackTrace (htdocs.wasm.framework.unityweb:8:22295)
at stackTrace [Object.stackTrace] (htdocs.wasm.framework.unityweb:8:22466)
at Object.onAbort (http://localhost/Build/UnityLoader.js:4:11047)
at abort (htdocs.wasm.framework.unityweb:8:484763)
at wasm-function[56208]:3
at wasm-function[16961]:46
at wasm-function[43219]:1456
at wasm-function[56097]:16
at dynCall_iii [Object.dynCall_iii] (htdocs.wasm.framework.unityweb:8:459875)
at invoke_iii (htdocs.wasm.framework.unityweb:8:339724)
at wasm-function[43216]:388
at wasm-function[43215]:75
at wasm-function[43213]:99
at wasm-function[43212]:7
at wasm-function[43531]:69
at wasm-function[43530]:7
at wasm-function[28791]:330
at wasm-function[16681]:48
at wasm-function[23219]:1236
at wasm-function[16681]:48
at wasm-function[23267]:1090
at wasm-function[28454]:534
at wasm-function[48795]:330
at wasm-function[23210]:101
at wasm-function[22913]:152
at wasm-function[28604]:71
at wasm-function[28603]:128
at wasm-function[23091]:1169
at wasm-function[22398]:52
at wasm-function[22915]:11
at wasm-function[56135]:22
at dynCall_viiiii [Object.dynCall_viiiii]
And there is more from where this came from. I tried to solve this by searching for that error in google but failed. Any suggestions?

Realm Object Server - Error: Your request parameters did not validate

I built a small iOS application which uses Realm instead of CoreData. The app does not require a login as it only stores data entered by the user. I'm currently trying to save users data so that if a user deleted the app for example, the data will be there by default the next the app is re-installed.
Here's where I am getting confused. Can I still use Realm Mobile Platform even though the app will not require a login screen. (i.e. data will automatically be saved for users who are logged-in to their iCloud accounts).
Here's what I've done so far:
I configured Realm Object Server on an AWS EC2 instance, and I can login to the realm dashboard through the browser just fine.
I configured the cloudKit stanza in the configuration.yml file as per the authentication instructions.
In my setupRealm() func, I tried the following code but I keep getting a parameters validation error:
SyncUser.logIn(with: cloudKitCredentials,
server: serverURL) { user, error in
if let user = user {
print("in")
}
else if let error = error {
fatalError(String(describing: error))
// Error: "Your request parameters did not validate."
}
This is the error message:
Error Domain=io.realm.sync Code=3
"Your request parameters did not validate."
UserInfo={statusCode=400,
NSLocalizedDescription=Your request parameters did not validate.}:
I suspect that the my iCloud user is not being tied with the object server, but I can't seem to put the pieces together. I'd appreciate any pointers.
The server requires a restart after editing the authentication lines in the configuration.yml.

VK Oauth: Authenticating user, giving error

I created an application in VK. But, when I try to authenticate a user, I am getting the following error:
{
error: "invalid_request",
error_description: "redirect_uri has wrong domain, check application settings"
}
Also, when I am creating application, I don't get any option to specify redirect-url.
Can anybody please help me, as to how should I resolve this error.
Go to https://vk.com/apps?act=manage, select needed app and click Manage. Click Settings on the left sidebar and edit Authorized redirect URI, Base domain and Site address fields (Under the Open API title)

AS3 FacebookDesktop Login fail with OAuthException - #2500 An active access token must be used to query information about the current user

I think this is because Facebook just made some changes to their login process.
A few days ago, my air app was working with the FacebookDesktop class from the facebook-actionscript-api. Today I opened the project, and noticed that the Facebook login screens are a little different than when I started building my app. After I type my userID and password in, I grant the app access to my public profile, friend list and photos. Then another screen comes up where I grant the app permission to post to my friends on my behalf.
Then the window closes, and I get 'OAuthException 2500 An active access token must be used to query information about the current user.'
When I sign into Facebook through a browser, I see that my app shows up under "Your Apps" but I can't log in and do anything through my app.
I'm using Adobe Flash with GraphAPI_Desktop_1_8_1.swc on OSX Lion.
Here is my code:
public function MyApp(){
FacebookDesktop.init(APP_ID, onInit);
}
protected function onInit(result:Object, fail:Object):void {
if (result) {
trace("onInit, Logged In\n");
} else {
trace("onInit, Not Logged In\n");
var permissions:Array = ["publish_stream", "user_photos"];
FacebookDesktop.login(onLogin, permissions);
}
}
protected function onLogin(result:Object, fail:Object):void {
if (result) {
trace("Logged In as:");
trace(FacebookDesktop.getSession().user.name);
} else {
trace("Login Failed");
trace('code: '+fail.error.code); //code: 2500
trace('message: '+fail.error.message); //message: An active access token must be used to query information about the current user.
trace('type: '+fail.error.type); //type: OAuthException
}
}
I get the same results when I use the FlashDesktopExample provided in the SDK (modified with my app ID of course).
Any help would be great! Thanks in advance!
I ran into this problem, too: the success URL did not have any parameters.
Cadderly82 is correct; it's a problem with secure navigation. Turning off my Facebook account's "Secure Browsing" option fixed the problem, but I didn't want to have to require users to do that.
I was able to solve this by setting ALL of the FacebookURLDefaults values to use "https://".
Now I get a valid user-access-token in the success URL; and I get valid values regardless of my facebook account's secure-browsing setting.
I have figured out the problem:
The LoginWindow class sets the token based on the uri.
This worked fine until the LOGIN_SUCCESS_URL (http://www.facebook.com/connect/login_success.html) and the LOGIN_SUCCESS_SECUREURL (https://www.facebook.com/connect/login_success.html) pages stopped including the access token in the uri.
Hence, the token is never set. Even though my app shows up under the 'Your Apps' section in Facebook after I login, my app still can't do anything without a token.
I have two solutions:
The easiest is to change the LOGIN_SUCCESS_URL and/or the LOGIN_SUCCESS_SECUREURL properties in com.facebook.graph.core.FacebookURLDefaults like the following.
beginning on line 82:
public static var LOGIN_SUCCESS_URL:String = 'http://www.facebook.com/connect/login_success.html';
public static var LOGIN_SUCCESS_SECUREURL:String = 'https://www.facebook.com/connect/login_success.html';
Change to:
public static var LOGIN_SUCCESS_URL:String = 'http://www.yourwebsite.com/';
public static var LOGIN_SUCCESS_SECUREURL:String = 'https://www.yoursecurewebsite.com/';
of course you would use your own website - not 'http://www.yourwebsite.com/'. I tried it using http://localhost/ and it worked great.
Another solution is:
Change com.facebook.graph.windows.LoginWindow with the following code. I have made some changes to my files, so please forgive me if the line numbers are different than what they are in a fresh copy of the SDK.
around line 143:
change:
vars.redirect_uri = FacebookURLDefaults.LOGIN_SUCCESS_URL;
to:
vars.redirect_uri = 'http://localhost/';
In production code, you probably want to use your own website address instead of localhost, but I used localhost for testing purposes.
Then, in the handleLocationChange function (should be around line 168) add this to the else if statements:
}else if (html.location.indexOf ('http://localhost/') == 0) {
loginCallback(getURLVariables(), null);
userClosedWindow = false;
html.stage.nativeWindow.close();
html.removeEventListener(Event.LOCATION_CHANGE, handleLocationChange);
}
As I said before, change localhost to your website address.
I hope this helps!
I was having the same problem for random users and I don't really know if it is a Facebook problem with secure navigation:
Check user properties in Facebook: Security Settings > Secure Browsing
(www.facebook.com/settings?tab=security)
For users with "disabled" state it works fine.
For users with "migration" state it gives the error.
For users with previously "enabled" state it works fine.
When I tried with users in "migration" state and changed to "disabled", it worked fine.
Then if I turned it "enabled", the "migration" state is gone and marked as "enabled", but the error it's still there.
So I guess this is the problem, but don't know how to fix it.
alot has change in a year this is what i think the answer is now
you need a token to login FacebookDesktop.getSession().accessToken
public function MyApp(){FacebookDesktop.init(APP_ID, onInit, FacebookDesktop.getSession().accessToken); }

Heroku - Application Error, but no error in logs

I'm hacking away at a Facebook app on Heroku, using Node.js. When I go to the app myself, it works exactly as I expect. When I send another developer/tester to it, the standard Heroku "Application Error" message is displayed. When I check the logs, there isn't even a log that the developer made a GET request for the app page, let alone an error.
He tells me that the last thing he sees in his browser status bar is "waiting for .herokuapp.com", which implies that Facebook got to the app, but the logs don't support this theory.
Is there another method of seeing Heroku errors? Is there something I have to turn on in order to see more? A setting I have to modify to let this other guy use the app?
Update: Some more looking around led me to check the network traffic. He's getting a 503 Service Unavailable, followed by the error page. Still wondering why this happens on his machine, but not mine.
Update: Inserted some error-checking code into the handle_facebook_request method.
req.facebook.app(function(err, app) {
if(err !== null) {
var errorMessage = "Error getting app: " + util.inspect(err['error']);
console.log(errorMessage);
}
// rest of req.facebook.me, and rendering code
}
This gives me an "Unsupported get request", of type "GraphMethodException" and code 100. So now I have something I can look into! I wish that Heroku had at least mentioned that the request had been tried.
I had the same problem with a new facebook app created with the support heroku / node.js.
After several attempts and tests I saw that I get the message "Unsupported get request", type "GraphMethodException" and the code 100, because my facebook app was with sandbox mode.
When I disabled the sandbox my application on heroku it worked fine.