Forum Discussion

khurlburt's avatar
khurlburt
Occasional Contributor
10 years ago

OAuth 2 Flow - Error getting token due to bad request

I have SoapUI Pro 5.1.2. I am attempting to get a token using OAuth2 Flow = "Authorization Code Grant".

In the SoapUI popup (titled "Get Access Token from the authorization server") I provide all of the following:

Client Identification
Client Secret
Authorization URI
Access Token URI
Redirect URI

I then click the "Get Access Token" button and I'm prompted to sign into Microsoft Azure (where my service resides). Next, I enter my credentials (which are accepted), and see the "Received authorization code" message (within the SoapUI popup (titled "Get Access Token from the authorization server")). Next, A window with the message "The page could not be loaded" pops up. When I close that window - the "Received authorization code" message (on SoapUI popup (titled "Get Access Token from the authorization server")) is replaced with "Retrieval canceled".

So I never get the token. However - Looking at the HTTP log: I DO get the Authorization Code.

Here is the error I see in the HTTP log:

Thu Dec 04 18:23:48 EST 2014:DEBUG:<< "HTTP/1.1 400 Bad Request[\r][\n]"

Thu Dec 04 18:24:44 EST 2014:DEBUG:<< "{"error":"invalid_request","error_description":"ACS50001: The required field \u0027resource\u0027 is missing.\r\nTrace ID: 79c923cb-4cc6-4a4d-9dcf-fb578f3a8c01\r\nCorrelation ID: 11a3007a-4387-436f-9669-b52fcf222a49\r\nTimestamp: 2014-12-04 23:24:45Z","error_codes":[50001],"timestamp":"2014-12-04 23:24:45Z","trace_id":"79c923cb-4cc6-4a4d-9dcf-fb578f3a8c01","correlation_id":"11a3007a-4387-436f-9669-b52fcf222a49"}"

The problem is that I don't see where I can supply the resource in the SoapUI popup (titled "Get Access Token from the authorization server"). And if the solution is that I need to add it to the input string for the "Access Token URI" textbox, what is the proper syntax? I am currently using "https://login.windows.net/mckdev.onmicrosoft.com/oauth2/token?api-version=1.0" as input for the "Access Token URI" textbox.

Any help with getting past this error would be greatly appreciated.

Thank you,
Kelli

4 Replies

  • khurlburt's avatar
    khurlburt
    Occasional Contributor
    Hi Marcus,

    Thanks for your reply.

    Prior to my post, I had already reviewed the details (at length) in the Microsoft link (http://msdn.microsoft.com/en-us/library ... 45542.aspx) you provided. I played with this for hours! I had already tried including the resource in both the "Authorization URI" and "Access Token URI" textboxes in the SoapUI popup titled "Get Access Token from the authorization server".

    I am getting the authorization code without issue. However, regardless of whether or not I include the resource in the "Authorization URI" or include it in the "Access Token URI", I still get the error I listed in my original post.

    So - if you're suggesting that I include the resource in one of the textboxes: Which textbox? And what is the syntax that SoapUI popup expects so that it passes the proper syntax to Windows?

    Thanks,
    Kelli
    • omar-delgado's avatar
      omar-delgado
      New Contributor

      I've been having a similar problem, did you ever resolve the issue?  If so, could you let me know how?