src/SDK/Corundum.php
protected function authorize(string $user, array $params = []): Slice
    {
        $grantType = $this->slice->getData('grant_type', 'password');
        $userData  = $this->slice->getSlice('users.' . $user);
        $defaults  = [
            'username'   => $userData->getRequired('username'),
            'password'   => $userData->getRequired('password'),
            'grant_type' => $grantType,
        ];

        $response = $this->apiRequest(new Slice([
            'params' => Arr::merge($defaults, $params)
        ]));

        if ($response)
        {
            $response->expires = Carbon::now()
                ->addSeconds($response->expires_in);
        }

        return $response;
    }
protected function authorize(string $user, array $params = []): Slice
    {
        $grantType = $this->slice->getData('grant_type', 'password');
        $userData  = $this->slice->getSlice('users.' . $user);
        $defaults  = [
            'username'   => $userData->getRequired('username'),
            'password'   => $userData->getRequired('password'),
            'grant_type' => $grantType,
        ];

        $response = $this->apiRequest(new Slice([
            'params' => Arr::merge($defaults, $params)
        ]));

        if ($response)
        {
            $response->expires = Carbon::now()
                ->addSeconds($response->expires_in);
        }

        return $response;
    }
protected function authorize ( string $ user , array $ params = [ ] ) : Slice { $ grantType = $ this -> slice -> getData ( 'grant_type' , 'password' ) ; $ userData = $ this -> slice -> getSlice ( 'users.' . $ user ) ; $ defaults = [ 'username' => $ userData -> getRequired ( 'username' ) , 'password' => $ userData -> getRequired ( 'password' ) , 'grant_type' => $ grantType , ] ; $ response = $ this -> apiRequest ( new Slice ( [ 'params' => Arr :: merge ( $ defaults , $ params ) ] ) ) ; if ( $ response ) { $ response -> expires = Carbon :: now ( ) -> addSeconds ( $ response -> expires_in ) ; } return $ response ; }
@param string $user
@param array  $params

@return Slice

@throws Invalid
@param string $user @param array $params