-
Notifications
You must be signed in to change notification settings - Fork 322
Description
π Describe the question:
Hello! Hope you are doing well! I've been stuck with the API authentication exercise. I'm using the demoqa.com site so I might be ignoring something.
This is what I have:
import { test as setup, type Page, chromium } from '@playwright/test';
const authFile = '.auth/api-admin.json';
setup('authenticate', async ({ request }) => {
// Send authentication request. Replace with your own.
await request.post('https://demoqa.com/Account/v1/GenerateToken', {
form: {
"email":"tau-admin",
"password":"TestingWithR3n@t@"}
});
await request.storageState({ path: authFile });
});
This will pass and I get a 200 response, but for some reason, there's no cookies info in the json file. This is the resulting json file
{ "cookies": [], "origins": [] }
Checking the tracing I don't see any cookies in the response.
I already tried with the different APIs that are available in the Swagger doc, but I'm getting the same result. The APIs I tried are:
https://demoqa.com/Account/v1/Authorized
https://demoqa.com/Account/v1/GenerateToken
https://demoqa.com/Account/v1/Login
My guess is that I have to use the generated token, but not sure how to accomplish this or if this is the right approach.
Hope that you can help π and thanks in advance!
π‘ A picture of your pet or a toy or something really cool:
