Forum Discussion

mbano's avatar
mbano
New Contributor
9 years ago

Re: OAuth 2 Flow - Error getting token due to bad request

I know this thread seems old however I've also come across this issue. I can successfully obtain an authorization code but cannot get further than that. I shall record the steps to recreate the problem in SoapUI 5.2.1:

 

1. In my test step I have added OAuth2 as the authorization profile.

2. Click "Get Token".

3. "Get Access Token from the authorization server" popup appears.

4. Select "Authorization Code Grant" as the "OAuth 2 Flow".

5. Fill out the remaining required fields.

6. Click "Get Access Token" button.

7. The SoapUI browser appears in a new window, then loads up the security login page. After entering the required details and submitting, the status on the "Get Access Token from the authorization server" popup changes to "Received authorization code".

8. The browser now displays nothing. Nothing appears to happen from this point on. The only action I can take is to close the browser, which results in the status changing to "Retrieval canceled".

 

Is there something else I might be missing? I have confirmed the details are correct for Client ID, Client Secret, Auth URI, Access Token URI and Redirect URI.

 

Hoping someone can help me.

4 Replies

  • mbano's avatar
    mbano
    New Contributor

    I have checked the soapui.log file and have noticed OAuthProblemExceptions being thrown. I have attached a portion of the log file.

     

    • nmrao's avatar
      nmrao
      Champion Level 3

      Please check with service provider or your team. From the log it is evident that it appeas an issue with the application /service

       

       description='Invalid response! Response body is not application/json encoded', uri='null', state='null', scope='null', redirectUri='null', responseStatus=0, parameters={}}
      com.eviware.soapui.impl.rest.actions.oauth.OAuth2Exception: org.apache.oltu.oauth2.common.exception.OAuthSystemException: OAuthProblemException{error='unsupported_response_type', description='Invalid response! Response body is not application/json encoded', uri='null', state='null', scope='null', redirectUri='null', responseStatus=0, parameters={}}
      • mbano's avatar
        mbano
        New Contributor

        Hi Rao,

         

        Thanks for getting back to me. I seem to have gotten past that issue but have now encountered a new error in the logs:

         

        2016-01-15 10:31:38,557 ERROR [errorlog] org.apache.oltu.oauth2.common.exception.OAuthSystemException: java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - For input string: "">"

         

        I'ev attached a sample of the log file again but this is the main information. Another application issue?

         

        Thanks!