Search code examples
google-apigoogle-oauthgoogle-api-nodejs-client

How do i make post request through google-auth-library?


I am successfully able to make GET requests to a service hosted behind IAP, but am running into issues when making POST requests the same way. Also, I was not able to find any documentation for the same. All examples seem to be for GET requests.


Solution

  • Equally frustrated with the terrible documentation on that library. Here is how to make a POST:

    const { status, data } = await client.request({
        url: 'https://example.com/some/path',
        method: 'POST',
        data: {
            hello: 'world'
        }
    })