{"id":6413,"date":"2014-04-17T02:01:51","date_gmt":"2014-04-17T02:01:51","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/17\/problem-about-access-token-collection-of-common-programming-errors\/"},"modified":"2014-04-17T02:01:51","modified_gmt":"2014-04-17T02:01:51","slug":"problem-about-access-token-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/17\/problem-about-access-token-collection-of-common-programming-errors\/","title":{"rendered":"problem about access-token-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/graph.facebook.com\/100002760780777\/picture?type=large\" \/><br \/>\nMike Bannion<br \/>\nfacebook-graph-api access-token facebook-access-token<br \/>\nBefore you start yelling at me, I know many users already asked for something like this, but I read all of them and couldn&#8217;t find any reply related to my specific case: I eventually managed to get something working but it&#8217;s not what I think I (and other developers) are looking for. I want to share my experience about this with all of you, so I&#8217;ll try and describe my scenario and the steps I followed to look into how to take care of this, so please indulge me for this long post: I&#8217;m sure it will<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/graph.facebook.com\/100001864813027\/picture?type=large\" \/><br \/>\n???<br \/>\njava facebook access-token urlconnection<br \/>\nI am trying to developing Facebook API using Java.It is success to get access_token from facebook as flow.String access_token_url = targetURI +&#8221;client_id=&#8221; + appId +&#8221;&amp;client_secret=&#8221; + appSecret +&#8221;&amp;code=&#8221; + code +&#8221;&amp;redirect_uri=&#8221; + redirectURI; \/\/ ???? ??URL url = new URL (access_token_url);URLConnection urlConn = url.openConnection();BufferedReader in = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));String accessTokenStr=&#8221;&#8221;;while ((accessTokenStr=in.readLine())<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/graph.facebook.com\/1313662766\/picture?type=large\" \/><br \/>\nFabr\u00edcio Jos\u00e9 Souza<br \/>\nfacebook-graph-api access-token facebook-access-token<br \/>\nI have reported a bug about this (https:\/\/developers.facebook.com\/bugs\/163942813778219).I have implemented the server-side login flow which is supposed to result a long-lived user acess_token.I have two cases where I am not able to obtain the long-lived token; the process runs properly though it results a short-lived token.One case is a general profile; the other one is a profile migrated into Page only.In all other tested cases it works properly, resulting a long-lived token, as expected.Still,<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d2b429e284dded2482b97f9252050a55?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRimante Baltiejute<br \/>\nmysql facebook flash access-token<br \/>\nI have flash game for Facebook. Yesterday It worked correct, successfully inserted data to database, but now when I try to start my app\/game I got error: Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. thrown in \/home\/padekime\/domains\/padekime.eu\/public_html\/images\/base_facebook.php on line 1254Here is my code:&lt;?php $request = $_REQUEST[&#8220;signed_request&#8221;]; list($encoded_sig, $load) = explode(&#8216;.&#8217;, $request, 2); $fbData = jso<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b05afdd985cb211e4c39ea8502dd6fa3?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nLeeTee<br \/>\nfacebook-graph-api oauth access-token<br \/>\nI am trying to find a way to keep connected with the Facebook API once authorised using OAuth but am having problems. I dont want the users of my App to have to login via Facebook every time they want to use my app. I store the oauth access toekn in a database after the user authenticates with facebook and I have &#8220;offline_access&#8221; permissions set, so in theory, this should be possible.However, I get &#8220;Uncaught OAuthException: An active access token must be used to query information about the curr<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d6b7a12296ad5ade25ec660b140bcca2?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nOwen Blacker<br \/>\nphp facebook-graph-api facebook-php-sdk access-token<br \/>\nI am using a fb:multi-friend-selector to send invitations to friends. Once the user submits the form its redirect to a page where I get the ids of the selected friends in order to post to their walls. I have requested authorization for offline_access but when the page loads it drops Uncaught OAuthException error. How can I use the access_token?$app_id = APP_ID; $canvas_page = CANVAS_PAGE_URL; $auth_url = &#8220;http:\/\/www.facebook.com\/dialog\/oauth?client_id=&#8221;. $app_id . &#8220;&amp;redirect_uri=&#8221; . urlencod<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/97d73c1173531f652fa01ada67f356b8?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBar<br \/>\nfacebook access-token<br \/>\nI&#8217;m trying to get friends list and I get this error:Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. thrown in \/server\/url\/base_facebook.php on line 970This is the code I&#8217;m using:$facebook = new Facebook(array(&#8216;appId&#8217; =&gt; $appID,&#8217;secret&#8217; =&gt; $appSecret,&#8217;cookie&#8217; =&gt; true, \/\/ enable optional cookie support )); $result = $facebook-&gt;api(&#8216;\/me\/friends\/&#8217;,array(&#8216;access_token&#8217; =&gt; $facebook-&gt;access_token));Here&#8217;s the dat<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/91f6d00a9df039bd1b06aec8e090137b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMassimo Sarzi<br \/>\nfacebook google-chrome access-token<br \/>\nI don&#8217;t understand why my app loose the access token only when I navigate with Chrome (in Firefox the access token stay for days).$facebook = new Facebook(array( &#8216;appId&#8217; =&gt; &#8216;XXXXXX&#8217;, &#8216;secret&#8217; =&gt; &#8216;XXXXXX&#8217;, &#8216;fileUpload&#8217; =&gt; false, &#8216;cookie&#8217;=&gt;true ));$access_token = $facebook-&gt;getAccessToken(); $userfb = $facebook-&gt;getUser();try {$user_profile = $facebook-&gt;api(&#8216;\/me?access_token=&#8217;.$accessToken); $userfb_id=$userfb;} catch(FacebookApiException $e) { $userfb=0;} if(!$userfb) {$ur<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/bv9tg.jpg?s=32&amp;g=1\" \/><br \/>\nfmendez<br \/>\nfacebook-graph-api facebook-php-sdk access-token facebook-oauth<br \/>\nI am getting this error when i open my app canvas. I already found out in which line the error comes up.User is logged in &lt;-(echo by php) Short Token is: XXXTOKENXXX &lt;-(echo by php) Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. thrown in \/var\/www\/vhosts\/xxx.de\/httpdocs\/src\/base_facebook.php on line 1254 It occurs when i request the following:$permissions = $facebook-&gt;api(&#8220;\/me\/permissions?access_token=&#8221; . $params[&#8216;a<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/659000aeea65bbad8296ab376e690799?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nShantha Kumara<br \/>\nphp facebook access-token<br \/>\nI am creating this url from jquery with an access tokenwww.mysite.com\/xyz.php?access_token=valid_access_token&amp;id=1and to upload photo I am using this code in xyz.php$facebook = new Facebook(array(&#8216;appId&#8217; =&gt; &#8216;my_app_id&#8217;,&#8217;secret&#8217; =&gt; &#8216;my_app_secret&#8217;,));\/\/ Get User ID $user = $facebook-&gt;getUser();$facebook-&gt;setFileUploadSupport(true); $args = array(&#8216;message&#8217; =&gt; &#8216;my_message&#8217;);copy($image, &#8216;tmp\/file.jpeg&#8217;);$args[&#8216;image&#8217;] = &#8216;@&#8217; . realpath(&#8216;tmp\/file.jpeg&#8217;);$data = $facebook-&gt;api(&#8216;m<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a80aadfaf5315eb8e2a3c13aae83620a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPax Maximinus<br \/>\ngoogle-chrome facebook-php-sdk access-token<br \/>\nI have an facebook app, with the PHP sdk. I works fine. The user can login without problem.But when I trace the $_SESSION, the access_token exists on many browsers, but not on Google Chrome.Can someone tell me where I can retrieve this token on Chrome ?Thanks.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b29e673f0d328b1ece7fef7bc0220108?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMarco Palermo<br \/>\nfacebook facebook-graph-api access-token<br \/>\nIf i try:https:\/\/graph.facebook.com\/me?access_token=MY_ACCESS_TOKENIt works. But if I make a call:$user_profile = $facebook-&gt;api(&#8216;\/me?access_token=&#8217;.MY_ACCESS_TOKEN);It doesn&#8217;t work:Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. thrown in \/home\/jill\/web\/public\/condividi\/libs\/facebook\/base_facebook.php on line 1033<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/4f8d4dbb79301767fd2f47cb0ffec459?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMartti Hyv\u00f6nen<br \/>\nfacebook-graph-api facebook-php-sdk access-token<br \/>\nI&#8217;m using Facebook PHP SDK and trying to post image to the user&#8217;s wall. However I get error below:&#8221;Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. thrown in C:\\developing&#8230;\\base_facebook.php on line 1033&#8243;I understand that my access token is not valid, but I can&#8217;t understand why. I have global facebook object and I&#8217;m using $facebook-&gt;api function in the subsite of my website (different url, where I have orginally asked access<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6cc3333c89544e453a827ccda764bf7c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPez Cuckow<br \/>\nphp facebook api access-token<br \/>\nI&#8217;ve been struggling to find out what is happening with this. My scripts were working fine for a bit and suddenly half stopped.I&#8217;m accessing the api and am getting back an access token. With the access token, I can access a users public info just fine. However, when I try to post info to their FB account I get this error.Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. Any idea what is happening here? I&#8217;m also using sessions o<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/722ccbc73f4cfe06baa6fcbeea652db6?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nnetwor<br \/>\nfacebook-php-sdk facebook-iframe access-token<br \/>\nIm getting this error:Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. thrown inIt only happens to users with HTTPS enbaled, it cause, because I have my app hosted on hosting without SSL. So Im using 2 hosting. I add my app from non-SSL hosting to iframe to my SSL host and then get this error&#8230;Here is my code:&lt;?phprequire &#8220;..\/fbapi\/src\/facebook.php&#8221;;$app_id = &#8220;xxxxxxxxx&#8221;; $app_secret = &#8220;xxxxxxxxxxxx&#8221;; $facebook = new Faceb<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/98d81436ab7e072eeac7a756e2b922d5?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser828835<br \/>\njavascript facebook graph connect access-token<br \/>\nSo I am using a function as such to get the access token of the already authenticated user that is currently on my website:var token; FB.getLoginStatus(function(response){if (response.session) { alert(response.session.access_token);\/\/This correctly shows the access token. &lt;&#8212;&#8211;GOOD token = response.session.access_token;} else{\/\/Other stuff. }} ); alert(token); \/\/This shows undefined. &lt;&#8212;&#8212;PROBLEMThe only way to know the access token it seems is to be within the anonymous function call<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/c1619b69f923aa11416fde0585eb5614?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nsebby_man<br \/>\nauthorization facebook-javascript-sdk access-token<br \/>\nI&#8217;m using the javascript sdk and I&#8217;m unclear about when I can make api calls. FB.api works just fine within the FB.getLoginStatus function, but the FB.api call on its own below prints the name &#8216;undefined&#8217;. Clearly I&#8217;m missing something fundamental. Should I be using the access token in some way?FB.getLoginStatus(function(response) {if (response.status === &#8216;connected&#8217;) {var uid = response.authResponse.userID;var accessToken = response.authResponse.accessToken;FB.api(&#8216;\/me&#8217;, function(response) {\/\/<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/5367aa1754ac17fd4e6460847a9f5ddb?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nGoni<br \/>\njavascript google-api access-token google-authentication expired<br \/>\nI have a client-side web app (no backend) that uses Google Javascript API. I have an issue regarding the access-token that I got after the login is successful.From the callback, we can see that the access-token is set to expire in 1 hour.expires_in: &#8220;3600&#8221;Question is, how can I &#8220;get a new token&#8221;? From the documentation, I&#8217;m under the impression that after the token is invalid, we have to (and I quote) perform a new re-authorization flow with immediate set to true to get an up-to-date access toke<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/34e2e0007a3cd14334b8dc025c02b456?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJohn Tangale<br \/>\nfacebook facebook-graph-api access-token<br \/>\nI am trying to create a non-expiring page token that I can use on my site to make posts on my Facebook page. According to scenario 5 in this document I should be able to do this:https:\/\/developers.facebook.com\/roadmap\/offline-access-removal\/My problem is that when I generate the page tokens, they expire in 1 hour.What I am doing is using this code to display my user access token when I login. I think this is the same token provided by graph api explorer, but I am unsure.require &#8216;..\/src\/faceboo<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/36c4d5e2e7cc8aab8ef4f5f0bbfbab8a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser2172159<br \/>\njava-ee google-api access-token google-oauth connection-timeout<br \/>\nI am able to get an authorization &#8220;code&#8221; in the callback from the user giving my web app permission to access a Google Calendar. But when I try to get an Access Token and Refresh Token using the following I am always getting a &#8220;java.net.SocketTimeoutException: connect timed out&#8221; exception for the following line in the code block that follows:googleTokenResponse = googleAuthorizationCodeTokenRequest.execute();The frustrating part is that I can get the Access Token and Refresh Token in a Grails we<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/graph.facebook.com\/100002897030879\/picture?type=large\" \/><br \/>\nKalle Stropp<br \/>\njavascript facebook access-token<br \/>\nI am trying to exchange a short-lived user access token for a ling-lived, but getting an an error (in all.js):ReferenceError: invalid assignment left-hand side &#8230;TZCOZCkuZBxZAzVUSokiOJbXZAHhESJvuA97qXTpVbVj3P7AZDZD&amp;expires=512326response.error.message: unknown errorCode:window.fbAsyncInit = function () {FB.init({appId: &#8216;xxx&#8217;, \/\/ App IDstatus: true, \/\/ check login statuscookie: true, \/\/ enable cookies to allow the server to access the sessionxfbml: true, \/\/ parse XFBMLoauth: true});FB.login<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/graph.facebook.com\/100000258374298\/picture?type=large\" \/><br \/>\nRonja Wilkening<br \/>\nfacebook graph access-token<br \/>\ni am calling the graph API with an App Access token (grant_type=client_credentials) to search for places on facebook. Quering for https:\/\/graph.facebook.com\/search?type=place&amp;center=50.785361,6.0334127Used return the search result reliably but suddenly stopped working with the following error:{&#8220;error&#8221;: {&#8220;message&#8221;: &#8220;An unknown error has occurred.&#8221;, &#8220;type&#8221;: &#8220;OAuthException&#8221;, &#8220;code&#8221;: 1} }I have tested the call on the Graph API Explorer. With my facebook user&#8217;s access token the request still ret<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/2b6f78b67e85ee4743f3dacc3039c179?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBen Pearce<br \/>\nfacebook-graph-api application get access-token facebook-access-token<br \/>\nI am trying to request the authtoken for my app via the Facebook API Graph Exlorer following the facebooks instructions. When I do a get call with a URL with the following form:https:\/\/graph.facebook.com\/oauth\/access_token?client_id=YOUR_APP_ID&amp;client_secret=YOUR_APP_SECRET&amp;grant_type=client_credentialsI get the following error:{&#8220;error&#8221;: {&#8220;message&#8221;: &#8220;Invalid callback&#8221;,&#8221;type&#8221;: &#8220;OAuthException&#8221;,&#8221;code&#8221;: 1} }Suggestions on how I might go about obtaining the access token for my app would be g<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mike Bannion facebook-graph-api access-token facebook-access-token Before you start yelling at me, I know many users already asked for something like this, but I read all of them and couldn&#8217;t find any reply related to my specific case: I eventually managed to get something working but it&#8217;s not what I think I (and other developers) are [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6413","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6413"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6413\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}