How to add Oauth 2.0 authorization header

Hi @“Trong Bui” ,
will it be available soon? In your next release?
If it is for soon, I prefer to wait.

Mara,

It depends on the information we get to support the case. Could you provide step by step you want to use the OAuth 2.0?

Hi @“Trong Bui” ,

I have to send different parameters, such as user’s email, password etc… to a specific URL in a POST request. And in response I should have an access token. That’s all.

Thanks Mara. We are working with development team to have it implemented. I will have you updated once it is ready in the release.

We would like to use OAuth 2.0 to integrate with Microsoft’s Graph API, which has the steps pretty well defined here:
https://developer.microsoft.com/en-us/graph/docs/concepts/auth_v2_user

@Trong Bui

which release OAuth 2.0 will be available for use? i am using 5.3

The support for OAuth 2.0 is still in progress.

which release OAuth 2.0 will be available to use? i am using Katalon studio 5.5 (Updated recently)

2 Likes

Hi guys,

I have the same issue.
So far I’ve tried the modifyObjectProperty to add the property of Authorization to the WS, but it doesn’t seem to work.
I’ve also tried parameters, but to no avail.

Are there any workarounds at the moment?

I found a solution for this:


Credit to @2862-Mariusz

Is there any news on when this will be implemented? I have tried to use the above solution but have not been successful.

Hi Justin,

I got this to work with the code below.

Hopefully it can assist you as well?

def SetWebServiceHeader() {
‘Set the Web Service call’

'Create new arrayList'  
ArrayList<TestObjectProperty> HTTPHeader = new ArrayList<TestObjectProperty>()  

'Send token in HTTP Header'  
HTTPHeader.add(new TestObjectProperty('Authorization', ConditionType.EQUALS, GlobalVariable.bearerKey.toString()))  

'Set the token'  
webLogin.setHttpHeaderProperties(HTTPHeader)  

return webLogin  

}

You will probably need to import these packages:

import java.net.Authenticator.RequestorType as RequestorType
import java.util.ArrayList
import com.kms.katalon.core.testobject.TestObjectProperty as TestObjectProperty

1 Like

Hi All,
Instead of OAuth 2.0 from Postman, I used OAuth 1.0 in Katalon and it is working fine. See the code below.

‘Create new array for headers’
ArrayList HTTPHeader = new ArrayList()

‘Add Content-Type header details’
HTTPHeader.add(new TestObjectProperty(‘Content-Type’, ConditionType.EQUALS, ‘application/json’))

‘Add Authorization:type header details’
HTTPHeader.add(new TestObjectProperty(‘Authorization:type’, ConditionType.EQUALS, ‘OAuth 1.0’))

‘Add Authorization header details using access token previous obtained’
HTTPHeader.add(new TestObjectProperty(‘Authorization’, ConditionType.EQUALS, 'bearer ’ + authToken))

‘Set new headers’
request.setHttpHeaderProperties(HTTPHeader)

Charles Brown said:

Hi Justin,

I got this to work with the code below.

Hopefully it can assist you as well?

def SetWebServiceHeader() {
‘Set the Web Service call’

'Create new arrayList'  
ArrayList<TestObjectProperty> HTTPHeader = new ArrayList<TestObjectProperty>()  

'Send token in HTTP Header'  
HTTPHeader.add(new TestObjectProperty('Authorization', ConditionType.EQUALS, GlobalVariable.bearerKey.toString()))  

'Set the token'  
webLogin.setHttpHeaderProperties(HTTPHeader)  

return webLogin  

}

You will probably need to import these packages:

import java.net.Authenticator.RequestorType as RequestorType
import java.util.ArrayList
import com.kms.katalon.core.testobject.TestObjectProperty as TestObjectProperty

Hi Charles Brown,

I have used a similar method to send the token in the Header of the Web service call, my issue is how can I get the token to begin with. Your code only describes how to add the token to the header which I can already do, albeit by manually retrieving the token first and then assigning it to a variable and passing that to the header.

Not having OAUTH 2.0 functionality is incredibly frustrating as it means I have to manually retrieve the token before each test run. If any one knows of a way to retrieve the token through an automated process, that would be amazing!

Many thanks,
Justin

Is Oauth2.0 authorization implemented. I have a lot of API stuff to test using this

1 Like

Just downloaded, and there is still no OAuth2 functionality. Is there a project road map available that indicates the timeline for this feature?

Him @josephdsaylor, we are gonna release a Beta version with OAuth2 very soon. Please stay tuned !

2 Likes

For all of you who are interested in this topic, the details about the release in which OAuth 2.0 will be available is here:
https://github.com/katalon-studio/katalon-studio/milestone/4

Have a good day everyone !

Hi @josephdsaylor, @Justin_Harper

The Beta version with OAuth 2.0 is available here:

http://forum.katalon.com/t/beta-release-for-oauth2-feature-of-api-testing/17993/2

Thanks for the support !

1 Like

Hi @ThanhTo, Thank you very much for your hard work! I have a few questions - BETA release for OAuth2 feature of API Testing - which you might be able to answer?

Thanks,
Justin