Пример #1
0
 public function action_callback()
 {
     try {
         $opauth = Auth_Opauth::forge(false);
         $opauth->login_or_register();
         Response::redirect('/admin/facebook');
     } catch (\OpauthException $e) {
         Response::redirect('/admin');
     } catch (\OpauthCancelException $e) {
         Response::redirect('/admin');
     }
 }
Пример #2
0
 public static function link_provider($user_id)
 {
     if ($authentication = Session::get('auth-strategy.authentication', [])) {
         $opauth = Auth_Opauth::forge(false);
         $insert_id = $opauth->link_provider(['parent_id' => $user_id, 'provider' => $authentication['provider'], 'uid' => $authentication['uid'], 'access_token' => $authentication['access_token'], 'secret' => $authentication['secret'], 'refresh_token' => $authentication['refresh_token'], 'expires' => $authentication['expires'], 'created_at' => date('Y-m-d H:i:s', Date::forge()->get_timestamp())]);
     }
 }