infrastructure/Auth/LoginProxy.php
/**
	 * Proxy a request to the OAuth server.
	 *
	 * @param string $grantType what type of grant type should be proxied
	 * @param array $data the data to send to the server
	 * @return array
	 */
Proxy a request to the OAuth server.
@param string $grantType what type of grant type should be proxied
@param array $data the data to send to the server
@return array
Proxy a request to the OAuth server . @param string $grantType what type of grant type should be proxied @param array $data the data to send to the server @return array
public function proxy($grantType, array $data = [])
	{
		$data = array_merge($data, [
			'client_id' => env('PASSWORD_CLIENT_ID'),
			'client_secret' => env('PASSWORD_CLIENT_SECRET'),
			'grant_type' => $grantType
		]);
		$response = $this->apiConsumer->post('/oauth/token', $data);
		if (!$response->isSuccessful()) {
			throw new InvalidCredentialsException();
		}
		$data = json_decode($response->getContent());
		return [
			'access_token' => $data->access_token,
			'refresh_token' => $data->refresh_token,
			'expires_in' => $data->expires_in
		];
	}
public function proxy ( $ grantType , array $ data = [ ] ) { $ data = array_merge ( $ data , [ 'client_id' => env ( 'PASSWORD_CLIENT_ID' ) , 'client_secret' => env ( 'PASSWORD_CLIENT_SECRET' ) , 'grant_type' => $ grantType ] ) ; $ response = $ this -> apiConsumer -> post ( '/oauth/token' , $ data ) ; if ( ! $ response -> isSuccessful ( ) ) { throw new InvalidCredentialsException ( ) ; } $ data = json_decode ( $ response -> getContent ( ) ) ; return [ 'access_token' => $ data -> access_token , 'refresh_token' => $ data -> refresh_token , 'expires_in' => $ data -> expires_in ] ; }
Proxy a request to the OAuth server.
Proxy a request to the OAuth server .