Hi,
I have a set of API that I need to use in my test for preparing my data. But those API are using a Google Authentication.
For now, since I am not using Codecept that’s not a big deal. But I’d like to move my test into Codecept for maintainability and readability purpose (and also because Codecept comes with a bunch of good plugins).
So my question is how can I use Google Auth with the REST plugin?
My current code looks like the following:
const { auth } = require('google-auth-library');
client = await auth.getIdTokenClient(process.env.GOOGLE_APPLICATION_TARGET_AUDIENCE);
response = await client.request({
method: 'POST',
url: `${process.env.API_ENDPOINT}/orders`,
data: order,
});
expect(response.data.success).toBeTruthy();