milosPavic / facebook-actionscript-api

Automatically exported from code.google.com/p/facebook-actionscript-api
0 stars 0 forks source link

init() failing with OAuthException #402

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1.Running FacebookMobile.init(MY_AP_ID, facebookInitHandler);
causes the success object in the callback to be null and fail has an error of 
""OAuthException" "An active access token must be used to query information 
about the current user." 

Is it possible I set something up incorrectly on Facebook's developer page?  I 
know I am using the correct ap id, but I am not using the Ap Secret any where, 
should I be?

What version of the product are you using? On what operating system?
I am using version Mobile 1.8.1 with Flex 4.6.  The issue is happening on both 
IOS and Android.

Any help would be greatly appreciated.  I have been struggling with this all 
day.

Original issue reported on code.google.com by jln6...@gmail.com on 15 Jan 2012 at 6:40

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Same error here...
Same Enviroment...

Original comment by francisv...@gmail.com on 16 Jan 2012 at 12:56

GoogleCodeExporter commented 8 years ago
We just forked the library for mobile and fixed the 402 issue.
The problem was with the expiration date of the token returned by the API. It 
returns the amount of seconds from now until the token expires. Just adding the 
current date in seconds seemed to fixed the problem.
We also fixed the JSON problem with AIR 3.0+

Take a look and let us know if it works for you:
https://github.com/TheDamArmada/Facebook-SDK-AS3-Mobile-

The Dam Armada

Original comment by jordi.ne...@gmail.com on 22 Jan 2012 at 11:21

GoogleCodeExporter commented 8 years ago
I've got same error. Try to use MobileLoginWindow directly.

Original comment by anton.we...@gmail.com on 1 Mar 2012 at 1:14

GoogleCodeExporter commented 8 years ago
Any workaround? using "The Dam Armada" com provides errors (about PNG ENCoder?)

Any working version of FacebookMobile for Flash builder 4.6 would be appricated 
:)

Original comment by G...@likeeat.co.il on 19 Mar 2012 at 4:00

GoogleCodeExporter commented 8 years ago
Problem still exists. Can't connect to facebook because of the following Error:

----- > :CLASS: fbInitCallbackHandler

error: An active access token must be used to query information about the 
current user.
error: 2500
error: OAuthException

Please get this error fixed!! The latest release is nearly 7 Months old. Please 
don't let this project die.

Original comment by klopskno...@googlemail.com on 21 May 2012 at 11:37

GoogleCodeExporter commented 8 years ago
THE SOLUTION:

from : http://forums.adobe.com/thread/928058

FacebookMobile.init("xxxxxxxxxxx", loginHandler);

function loginHandler(response:Object, fail:Object):void

{  

    if(response)

     {

          // good the user is already connected

     }

     else

     {

          var myWebView:stageWebView = new StageWebView();

          myWebView.stage = this.stage;

          myWebView.viewPort = new Rectangle(0,0,stage.stageWidth,stage.stageHeight);

          FacebookMobile.login(handleLogin, stage, extendedPermissions, myWebView);

     }

}

Original comment by shomr...@gmail.com on 29 Dec 2012 at 7:14

GoogleCodeExporter commented 8 years ago
To really solve problem, do it:

if (html.location.indexOf('?#') != -1) {
    params = html.location.slice(html.location.indexOf('?#')+2);
    ...

see git diff...

src/com/facebook/graph/windows/AbstractWindow.as
...

@@ -280,8 +280,9 @@ package com.facebook.graph.windows {
      */
     protected function getURLVariables():URLVariables {
       var params:String;
-
-      if (html.location.indexOf('?') != -1) {
+      if (html.location.indexOf('?#') != -1) {
+          params = html.location.slice(html.location.indexOf('?#')+2);
+      } else if (html.location.indexOf('?') != -1) {
         params = html.location.slice(html.location.indexOf('?')+1);
       } else if (html.location.indexOf('#') != -1) {
         params = html.location.slice(html.location.indexOf('#')+1);

Original comment by lag...@gmail.com on 16 Oct 2013 at 11:36

GoogleCodeExporter commented 8 years ago
solved the issue with 
if (html.location.indexOf('?#') != -1) {
    params = html.location.slice(html.location.indexOf('?#')+2);
THANKS lag...@gmail.com

Original comment by hanif...@gmail.com on 17 Oct 2013 at 12:00

GoogleCodeExporter commented 8 years ago
So not sure if this will help anyone in the future that has this kind of 
problem, but for me... the reason was I was asking for "user_email" in the 
login perms.  Turns out that you can't initially ask for any of the "user_XXXX" 
permissions until after you have a token... then ask for extended perms.  once 
I changed my login perms to only read var perms:Array = ["read_stream"];, 
everything worked as expected

Original comment by jasonmre...@gmail.com on 26 Dec 2013 at 9:41