Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Error Retrieving Authorization Token in the Server API Tool 2023.1

NBrown01
5 - Atom

I recently downloaded the new Server API Tool 2023.1 but when I try and run the tool, I receive an error "The test "Error retrieving authorization token" failed: ExpectedNumRecords==0,NumRecords(#1)==1." Hoping someone has insight as to how to remedy this.

 

I have followed the instructions here: Server API Tool | Alteryx Help

  • oathlib and requests_oathlib are installed
  • I have server API access
  • I have authorized my server API access on Swagger.

As you can see in the workflow below, I'm simply testing the tool and don't have any other components to the workflow.

  • I've configured the tool with the Base URL https://[BaseURL]/webapi/
  • Entered my API Key & API Secret
  • Using the GET method
  • Tried multiple GET endpoints including /v3/users 

NBrown01_1-1686800260918.png

 

NBrown01_2-1686800292117.png

 

3 REPLIES 3
mkorpi
8 - Asteroid

Has anyone found a solution? I am having similar issues.

Treyson
13 - Pulsar
13 - Pulsar

The only thing I can think of is that if you are querying this from within the server, you may need to do localhost, instead of the URL. I have found some interesting things happening in the swagger documentation when this is the case.

Treyson Marks
Managing Partner
DCG Analytics
NBrown01
5 - Atom

Jarrod at Alteryx reached out and helped me with a workaround. If I'm understanding correctly, the issue comes from cert verify errors if they aren't updated frequently. It sounds like they are working on creating a fix in the tool's next release.

 

In the meantime, he had me make a few minor adjustments to the python script. I've included the steps below, but I'm not a python expert, so I can't guarantee it will work for you. If you make the changes and it doesn't work, I'd recommend undoing them before continuing your troubleshooting.

 

Steps to bypass the error:

1. Open the MACRO for the Server API Tool

2. In the "Authenticate" section, select the Python Tool.

3. Select "Interactive" in the configuration window.

4. Scroll down to the section In[3]: and comment out (put a hashtag) before the second line

#os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'

5. In Section In [3]:  On the third line under "try", add verify=False

token = oauth.fetch_token(token_url=baseUrl+'/oauth2/token', client_id=client_id, client_secret=client_secret, verify=False)

6. In the configuration window, just above the code, hit the save button.

7. Scroll down and to the right in the canvas window to find the Python tool in the API Calls, Logging, and Output container

8. Select "Interactive" in the configuration window.

9. Scroll down to the section In [3]: and update the response row under def ayxServerAPI... to include "verify=False"

response = requests.request(method, url, headers=hed, data=payload, files=files, stream=stream, verify=False)

10. In the configuration window, just above the code, hit the save button.

Labels
Top Solution Authors