public function token()
    {
        $payload = [
            'auth'        => [$this->config['client_id'], $this->config['client_secret']],
            'form_params' => ['grant_type' => 'client_credentials'],
        ];

        $request = array_merge($this->requestTemplate, $payload);
        $rawResponse = $this->getHttpClient()->post($this->buildUrlFromString('oauth2/token'), $request);
        $rawResponse = $this->responseToArray($rawResponse);

        return [
            'token'  => Arr::get($rawResponse, 'access_token'),
            'type'   => Arr::get($rawResponse, 'token_type'),
            'scope'  => Arr::get($rawResponse, 'scope'),
            'expiry' => isset($rawResponse['expires_in'])
                ? time() + Arr::get($rawResponse, 'expires_in')
                : null,
        ];
    }
public function token()
    {
        $payload = [
            'auth'        => [$this->config['client_id'], $this->config['client_secret']],
            'form_params' => ['grant_type' => 'client_credentials'],
        ];

        $request = array_merge($this->requestTemplate, $payload);
        $rawResponse = $this->getHttpClient()->post($this->buildUrlFromString('oauth2/token'), $request);
        $rawResponse = $this->responseToArray($rawResponse);

        return [
            'token'  => Arr::get($rawResponse, 'access_token'),
            'type'   => Arr::get($rawResponse, 'token_type'),
            'scope'  => Arr::get($rawResponse, 'scope'),
            'expiry' => isset($rawResponse['expires_in'])
                ? time() + Arr::get($rawResponse, 'expires_in')
                : null,
        ];
    }
public function token ( ) { $ payload = [ 'auth' => [ $ this -> config [ 'client_id' ] , $ this -> config [ 'client_secret' ] ] , 'form_params' => [ 'grant_type' => 'client_credentials' ] , ] ; $ request = array_merge ( $ this -> requestTemplate , $ payload ) ; $ rawResponse = $ this -> getHttpClient ( ) -> post ( $ this -> buildUrlFromString ( 'oauth2/token' ) , $ request ) ; $ rawResponse = $ this -> responseToArray ( $ rawResponse ) ; return [ 'token' => Arr :: get ( $ rawResponse , 'access_token' ) , 'type' => Arr :: get ( $ rawResponse , 'token_type' ) , 'scope' => Arr :: get ( $ rawResponse , 'scope' ) , 'expiry' => isset ( $ rawResponse [ 'expires_in' ] ) ? time ( ) + Arr :: get ( $ rawResponse , 'expires_in' ) : null , ] ; }
Generate an access token to be used on subsequent requests.

@return array
Generate an access token to be used on subsequent requests .