+ // Try OAuth when no user is provided
+ $oauth1 = new FKOAuth1();
+ // login with oauth
+ try {
+ $request = OAuthRequest::from_request();
+ list($consumer, $token) = $oauth1->verify_request($request);
+ if (!is_null($token)) {
+ $oauth1->loginUser($token->uid);
+ Session::set('allow_api', true);
+ return;
+ }
+ echo __FILE__.__LINE__.__FUNCTION__ . "<pre>";
+ var_dump($consumer, $token);
+ die();
+ } catch (Exception $e) {
+ Logger::warning(API_LOG_PREFIX . 'OAuth error', ['module' => 'api', 'action' => 'login', 'exception' => $e->getMessage()]);
+ }
+