Generate Auth token using API + client certificate with password using playwright tool

443 Views Asked by At

In this we are Sending HTTP request with parameter as client certificate and password to get the Auth Token from server. we are doing this with playwright tool in typescript lang.

Getting Error like- 400 Bad Requests

import { test, expect } from "@playwright/test"; import { stringify } from 'querystring'; 
test('test', async ({ request, baseURL }) => {

const response = await request.post("https://abc.unobank.com/syst-open-banking//private/oauth2/token", { 

headers: { 'Content-Type': 'application/x-www-form-urlencoded',     
},
    data:stringify ({
        grant_type: 'client_credentials',
        scope: 'accounts payments funds confirmations',
        client_id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
        username : 'xxxxxxxx_path_of _client_certificate_xxxxxxxxxxxxxx',
        password: 'xxxxxxxxx_certificate_password_xxxxxxxxxxxxxxxxxxx',
    })
    });
console.log(response);
});
0

There are 0 best solutions below