coldfusion - FB Cookies are cached in Facebook App -
I am using the affinate Facebook API for ColdFusion to develop a Facebook app and with me later events The real problem is authentication.
The API clears the application cookie properly and I'm logged in, but with the help of an extra call on the template, if you reload everything decreases and I I can get the user token with an access token.
I have called the API in an application.cfc in an online event.
So it is a strange thing, no matter how many calls to the API from the collision, the only thing that will get me the latest app cookie is reloading the template (I get javascript in the form of a workaround I do).
It seems that the app cookie is cached in any way and is refreshed only on the reload, still the user is authenticated.
The process for recapturing is as follows:
- Internal Event
- API Scrap Cookie
- Internal Event
- API Scrap Cookie
- We have Facebook UID and AccessToken.
This session's cookie settings are in Application.cfc.
& lt; Cfset this is this op management = true / & gt; & Lt; Cfset THIS.SetClientCookies = true / & gt; & Lt; Cfset THIS.ClientManagement = true / & gt;
Thank you for your help!
The OnRequest code is quite wide, but it goes here:
import facebook.sdk.facebookApp; Import facebook.sdk.FacebookGraphAPI; // replace it with your appId and incognito APP_ID = "zzz"; SECRET_KEY = "zzz"; API_KEY = "zzz"; Session.appID = APP_ID; Session.apiKey = API_KEY; // Create FacebookApp Example //this.utils.runTimer ("facebookAuth-newfacebookApp," Start "); FacebookApp = New Facebook App (APID = APIIID, SecretKey = SECERKEE); //this.utils.runTimer("facebookAuth-newfacebookApp "," Stop "); Session.fbApp = facebookApp; // We can not or can not do this data based on URL or cookie based session // // If we receive a session here, its meaning That is, we have been using correctly signed sessions // application only know Facebook and application. I do not know if // if we call the API using session, it is still valid. One session may be invalid if it has already ended (in this case // session did not return Or if the user has authenticated outside Facebook. //this.utils.runTimer ("facebookAuth-getUserSession"|"start "); UserSession = facebookApp.getUser session (); //this.utils.runTimer ( "FacebookAuth-getUserSession", "stop"); authenticated = false; if (stratakexists (user session, "uid")) (if (Stratax Axisists (session. FBUSER session, "UID") (if user session UIC session, FBUSAR session, UID) {// reset session variable;}} Session.fbUser session = user session; try {facebookGraphAPI = new FacebookGraphAPI (user session.access_token ); Session.fbGraphAPI = facebookGraphAPI; Session.fbGraphAPI = facebookGraphAPI; if (not session.fbAuthenticated) {session.fbAuthenticated = true; Session.justLoggedIn = true;} Session.fbLoginCounter = 3; certified = true;} hold (no exception ) {// Exception exception (OAuthInvalidTokenException), usually an invalid session} {facebookGraphAPI = new FacebookGraphAPI ();}} and {facebookGraphAPI = new FacebookGraphAPI (); Session.fbUs Er session = straightenai (); //this.utils.runTimer("facebookAuth-FacebookGraphAPI-else" ,"stop ");} Session.parameters = structNew (); Session.parameters [" req_perms "] =" publish_stream, email ";
Then I can use FB cookie through session.
I'm curious about this section here:
if (strataxexists (session. FBUser session, "UID") (if (user session.uid NEQ session.fbUserSession.uid) {// Reset session variable;}} Session.fbUser session = user session;
First there is a value in session.fbUserSession.uid on request? I do not think it seems that you are not setting that value to the third row after that. Does this mean that whatever changes / / Will the reset session variable be called? And will it possibly cause you some problems? I do not know that this code What does, but what I see from that session, at least until the second request in the FBUSER session there will be no value for your check. This means that the reset session variable code is the first time every time Will you run on request. Do you want?
Comments
Post a Comment