cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Oauth 2.0 with grant type password? I also need to supply Authorizatio header value.

Occasional Contributor

How to use Oauth 2.0 with grant type password? I also need to supply Authorizatio header value.

1. I get access token like this:  (POST)

    https://url/auth-service/oauth/token?grant_type=password&username=username&password=password

2. I also set header Authorization value in the header (Authorization: Basic <token>).

 

How can I use the Authorization Profiler for the same?

 

4 REPLIES 4
Contributor

Re: How to use Oauth 2.0 with grant type password? I also need to supply Authorizatio header value.

@sguru, are you using SoapUI pro or OS version. In Pro you can use Auth manager to configure OAuth 2.0. Then use that auth profile in your REST calls. Authorization token will be automatically moved to header section.

 

In OS version, Rest testStep's Authorization section has an option to select oauth2.0. 

Occasional Contributor

Re: How to use Oauth 2.0 with grant type password? I also need to supply Authorizatio header value.

I am using Soap UI PRO 2.3.0.

I have explored those already, the auth manager is not supporting this.

We retrieve the auth token by giving username/password with grant=password through URL & supplying Basic Authorization as part of the header.

 

Can you eloborate more on this how to do it in PRO?

Contributor

Re: How to use Oauth 2.0 with grant type password? I also need to supply Authorizatio header value.

@sguru, I didn't realize that Grant Type Password is not a valid option in SoapUI's grant type selection.

Currently I am using client credential grant for my projects. 

 

However, I found one more topic and user marked it as a solution. Please take a look.

https://community.smartbear.com/t5/SoapUI-Pro/How-can-I-support-an-OAuth2-grant-type-of-password/td-...

 

Occasional Contributor

Re: How to use Oauth 2.0 with grant type password? I also need to supply Authorizatio header value.

I had already tried this though, was not successful. The same works successfully when given through REST request.

 

{
    "timestamp": 1525101120712,
    "status": 500,
    "error": "Internal Server Error",
    "exception": "java.lang.RuntimeException",
    "message": "org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.postObjectStoreImpl': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.",
    "path": "/oauth/token"
}

 

New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors