src/Web/User.php
public function loginByAccessToken($token, $type = null)
    {
        /* @var $class IdentityInterface */
        $class = $this->identityClass;
        return $class::findIdentityByAccessToken($token, $type)
            ->then(function($identity) {
                return $this->login($identity)
                    ->then(function() use (&$identity) {
                        return $identity;
                    });
            });
    }
public function loginByAccessToken($token, $type = null)
    {
        /* @var $class IdentityInterface */
        $class = $this->identityClass;
        return $class::findIdentityByAccessToken($token, $type)
            ->then(function($identity) {
                return $this->login($identity)
                    ->then(function() use (&$identity) {
                        return $identity;
                    });
            });
    }
Logs in a user by the given access token.
This method will first authenticate the user by calling [[IdentityInterface::findIdentityByAccessToken()]]
with the provided access token. If successful, it will call [[login()]] to log in the authenticated user.
If authentication fails or [[login()]] is unsuccessful, it will return null.
@param string $token the access token
@param mixed $type the type of the token. The value of this parameter depends on the implementation.
For example, [[\yii\filters\auth\HttpBearerAuth]] will set this parameter to be `yii\filters\auth\HttpBearerAuth`.
@return ExtendedPromiseInterface with IdentityInterface|null the identity associated with the given access token. Null is returned if
the access token is invalid or [[login()]] is unsuccessful.