/** * Sign in user with its access token * The signin is only available for this call, no session * * @param string $accesstoken * * @return array the user informations or false if failed */ public static function signInWithAccessToken($accesstoken) { $username = self::getUsernameFromAccessToken($accesstoken); if (is_null($username)) { return false; } $ip = self::getClientIp(); $ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; $ts = date("U"); $cu = get_current_url(true); self::$api_session = array('username' => $username); self::$auth['users'][$username]['api_logincount'] = (int) @self::$auth['users'][$username]['api_logincount'] + 1; self::$auth['users'][$username]['api_lastlogin'] = array('ip' => $ip, 'ua' => $ua, 'ts' => $ts); if (!is_null($cu)) { self::$auth['users'][$username]['api_lastlogin']['ur'] = $cu; } self::save(); return self::$auth['users'][$username]; }