protected function signIn($duration = null): Token
    {
        $options = $this->signInOptions($duration);

        $response = $this->client->request(
            'GET',
            self::SIGN_IN_URL,
            $options
        );

        $data = \GuzzleHttp\json_decode($response->getBody(), true);

        $token = $this->tokenFromResponse($data);
        $this->logger->info(
            'Retrieved a new mpx token {token} for user {username} that expires on {date}.',
            [
                'token' => $token->getValue(),
                'username' => $this->user->getMpxUsername(),
                'date' => date(DATE_ISO8601, $token->getExpiration()),
            ]
        );

        return $token;
    }
protected function signIn($duration = null): Token
    {
        $options = $this->signInOptions($duration);

        $response = $this->client->request(
            'GET',
            self::SIGN_IN_URL,
            $options
        );

        $data = \GuzzleHttp\json_decode($response->getBody(), true);

        $token = $this->tokenFromResponse($data);
        $this->logger->info(
            'Retrieved a new mpx token {token} for user {username} that expires on {date}.',
            [
                'token' => $token->getValue(),
                'username' => $this->user->getMpxUsername(),
                'date' => date(DATE_ISO8601, $token->getExpiration()),
            ]
        );

        return $token;
    }
protected function signIn ( $ duration = null ) : Token { $ options = $ this -> signInOptions ( $ duration ) ; $ response = $ this -> client -> request ( 'GET' , self :: SIGN_IN_URL , $ options ) ; $ data = \ GuzzleHttp \ json_decode ( $ response -> getBody ( ) , true ) ; $ token = $ this -> tokenFromResponse ( $ data ) ; $ this -> logger -> info ( 'Retrieved a new mpx token {token} for user {username} that expires on {date}.' , [ 'token' => $ token -> getValue ( ) , 'username' => $ this -> user -> getMpxUsername ( ) , 'date' => date ( DATE_ISO8601 , $ token -> getExpiration ( ) ) , ] ) ; return $ token ; }
Sign in the user and return the current token.

@param int $duration (optional) The number of seconds for which the token should be valid.

@return Token
Sign in the user and return the current token .