common\models\User::findIdentityByAccessToken PHP Method

findIdentityByAccessToken() public static method

public static findIdentityByAccessToken ( $token, $type = null )
    public static function findIdentityByAccessToken($token, $type = null)
    {
        throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
    }

Usage Example

Example #1
0
 public function init()
 {
     $this->registerAssets();
     parent::init();
     // If API log in is allowed AND the auth-token is provided.
     // todo refactor this, ATM a clug to get it working - DJE : 2015-07-23
     if ($this->allowAPILogin && (Yii::$app->request->get('auth-token') != false && Yii::$app->request->get('auth-token') !== null)) {
         /* Yii::$app->response->format = \yii\web\Response::FORMAT_RAW;
            $headers = Yii::$app->response->headers;
            $headers->add('Content-Type', 'application/json; charset=utf-8'); */
         // Guest user still needs session to hide header
         if (Yii::$app->request->get('auth-token') != "guest") {
             $userMDL = User::findIdentityByAccessToken(Yii::$app->request->get('auth-token'));
             // if the user was successfully logged in, return a message saying so
             if (Yii::$app->user->login($userMDL)) {
                 //$returnData = ['status' => 'success' ];
             } else {
                 //$returnData = ['status' => 'failed'];
             }
             //echo json_encode( $returnData );
         }
         Yii::$app->session->set('mobile', 'true');
         Yii::$app->response->redirect(\Yii::$app->urlManager->createAbsoluteUrl('forum'));
         Yii::$app->end();
     }
     // @depricated 2.0.0 Use the parent applications error settings
     /*
     \Yii::$app->setComponents(
         array(
             'errorHandler' => [
                 'errorAction' => 'site/error'
             ],
         )
     );
     */
     // @todo no longer needed per Yii2
     /*
     // import the module-level models and components
     $this->setImport(array(
         $this->id.'.models.*',
         $this->id.'.components.*',
     ));
     */
 }
All Usage Examples Of common\models\User::findIdentityByAccessToken