How can add authorisation type in API testing?

Every API testing tool has authorisation types Basic,NTLM,Kerberos,OAuth 2.0,OAuth 1.0

but in katalon i can only able to find basic type,how can i OAuth 2.0 type in katalon?

You can send OAuth token in request header like this:

def static request(String token) { RequestObject req = new RequestObject('test') TestObjectProperty prop1 = new TestObjectProperty() prop1.setName('Authorization') prop1.setValue(token) List<TestObjectProperty> headers = new ArrayList<TestObjectProperty>() headers.add(prop1) req.setRestRequestMethod("GET") req.setRestUrl("https://www.google.sk") req.setHttpHeaderProperties(headers) def respRaw = WS.sendRequest(req)`` }

Marek Melocik said:

You can send OAuth token in request header like this:

def static request(String token) { RequestObject req = new RequestObject('test') TestObjectProperty prop1 = new TestObjectProperty() prop1.setName('Authorization') prop1.setValue(token) List&lt;TestObjectProperty&gt; headers = new ArrayList&lt;TestObjectProperty&gt;() headers.add(prop1) req.setRestRequestMethod("GET") req.setRestUrl("https://www.google.sk") req.setHttpHeaderProperties(headers) def respRaw = WS.sendRequest(req)`` }

Hi Marek, how do you get your token in the first place? Is this a manual step or have you found a way to automate it?

Thanks,
Justin

Hi Justin,

I get token in other method - I don’t know what kind of token you use, but you can send a token request to your auth service and you’ll get a token (or response which contains a token) and you just parse the token from it.

Hi all

Can anyone elaborate on how to use Oauth 2 token when We have all the relevant details such as client id, client secret, authorization URI, Acces token URI, Redirect URI and Oauth 2 Flow type

Have you found the way to find the token, Priyanka?