How to use wpcom-proxy-request - 3 common examples

To help you get started, we’ve selected a few wpcom-proxy-request examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Automattic / wp-calypso / client / lib / wpcom-undocumented / lib / me.js View on Github external
client_id: config( 'wpcom_signup_id' ),
		client_secret: config( 'wpcom_signup_key' ),
	};

	const args = {
		path: '/me/social-login/connect',
		body: body,
	};

	/*
	 * Before attempting the social connect, we reload the proxy.
	 * This ensures that the proxy iframe has set the correct API cookie,
	 * particularly after the user has logged in, but Calypso hasn't
	 * been reloaded yet.
	 */
	require( 'wpcom-proxy-request' ).reloadProxy();

	this.wpcom.req.post( { metaAPI: { accessAllUsersBlogs: true } } );

	return this.wpcom.req.post( args, fn );
};
UndocumentedMe.prototype.preferences = MePreferences;
github Automattic / wp-calypso / client / lib / wpcom-undocumented / lib / me.js View on Github external
client_id: config( 'wpcom_signup_id' ),
		client_secret: config( 'wpcom_signup_key' ),
	};

	const args = {
		path: '/me/social-login/connect',
		body: body,
	};

	/*
	 * Before attempting the social connect, we reload the proxy.
	 * This ensures that the proxy iframe has set the correct API cookie,
	 * particularly after the user has logged in, but Calypso hasn't
	 * been reloaded yet.
	 */
	require( 'wpcom-proxy-request' ).reloadProxy();

	this.wpcom.req.post( { metaAPI: { accessAllUsersBlogs: true } } );

	return this.wpcom.req.post( args, fn );
};
github Automattic / wp-api-console / src / auth / proxy.js View on Github external
new Promise( resolve => {
		proxy( req, ( err, body, xhr ) => {
			resolve( {
				status: xhr.status === undefined ? 200 : xhr.status,
				body,
				error: err,
			} );
		} );
	} )
;

wpcom-proxy-request

Proxied cookie-authenticated REST API requests to WordPress.com.

GPL-2.0
Latest version published 2 months ago

Package Health Score

93 / 100
Full package analysis

Popular wpcom-proxy-request functions