Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added function setPersistentAccessToken()

  • Loading branch information...
commit 5182a200bdce897491b8f5c4d7d488789ccb1fed 1 parent 6c82b3f
@genesis19 authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 src/base_facebook.php
View
19 src/base_facebook.php
@@ -330,6 +330,25 @@ public function setAccessToken($access_token) {
}
/**
+ * Sets the new access token persistently and refreshes user's cache,
+ * so even after refresh,
+ * the given access token still persists.
+ * Use it if you need
+ * to set accesss token which has been taken from database,
+ * for example
+ *
+ * @param string $access_token an access token
+ * @return BaseFacebook
+ */
+ public function setPersistentAccessToken($access_token) {
+ $this->accessToken = $access_token;
+ $this->user = $this->getUserFromAccessToken();
+ $this->setPersistentData('access_token', $access_token);
+ $this->setPersistentData('user_id', $this->user);
+ return $this;
+ }
+
+ /**
* Determines the access token that should be used for API calls.
* The first time this is called, $this->accessToken is set equal
* to either a valid user access token, or it's set to the application
Please sign in to comment.
Something went wrong with that request. Please try again.