You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using playwright with JavaScript/Typescript
version: 10.8.1
I have 2 methods, 1 in which I am getting the auth token in order to make the next api call
I think I have the syntax wrong somewhere but I have no idea where. I am doing pretty much what I am doing in the previous api call except I am importing parts of an api array (which works fine in other api calls).
`let apiURL = process.env.API_URL;
let token: any;
I am using playwright with JavaScript/Typescript
version: 10.8.1
I have 2 methods, 1 in which I am getting the auth token in order to make the next api call
I think I have the syntax wrong somewhere but I have no idea where. I am doing pretty much what I am doing in the previous api call except I am importing parts of an api array (which works fine in other api calls).
`let apiURL = process.env.API_URL;
let token: any;
async get_token(): Promise {
axios({
method: 'post',
url: apiURL + apis.authenticate,
data: {
username: 'string',
password: 'string',
apiKey: 'string'
}
}).then(async function (response) {
token = response.data.token;
expect(response.status).toBe(200);
});
}
async cancel_appointment(): Promise {
axios({
method: 'put',
url: apiURL + apis.cancel[0] + accountNumber + apis.cancel[1] + appointmentNumber + apis.cancel[2],
headers: {
'Authorization':
Bearer ${token}
}
}).then(async function (response) {
console.log(response.data);
console.log(response.status);
console.log(response.statusText);
console.log(response.headers);
console.log(response.config);
expect(response.status).toBe(200);
});
}`
Error: AxiosError: Request failed with status code 401
Any help would be greatly appreciated!!
The text was updated successfully, but these errors were encountered: