Free Trial

Alteryx Designer Desktop Discussions

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

Alteryx API and Refresh Token

digeorgiok
6 - Meteoroid

Hello, 

 

I need help desperately. A former employee created a workflow within our company to set up an API with a refresh token for CCH Axcess. It currently keeps crashing and requires manual updates by visiting a URL link to refresh the API or Refresh token i am assuming. I need to fix this issue to prevent the workflow from crashing, but I’m lost since he left no notes or details. Below is a screenshot of the relevant section of the workflow.

 

Additional details: It appears he calls the API twice—first with a POST request and then with a GET request. Simultaneously, using two other input tools, he generates a refresh token and updates an Excel workbook to store that information. However, the refresh token isn’t connected to anything. I believe this refresh token should be used to call the API.

 

I am brand new to working with APIs and refresh tokens, so I apologize in advance for any follow-up questions.

 

 

5 REPLIES 5
apathetichell
19 - Altair

The refresh token is appended to the main datastream via the append fields tool. This is not how I would do it -> but it makes logical sense. I believe your issue is elsewhere (IE you are not receiving your token becaues your oauth call is broken). I do not see this as a workflow issue.

digeorgiok
6 - Meteoroid

He is appending the "Authorization" not the refresh token to the append tool. The refresh token is only getting posted to that output tool. I don't see how posting it to an Excel with no linkage would case it to inputted into an download tool. 

 

Do you have an example of someone using a refresh token for the download tool instead for the original API calling?

apathetichell
19 - Altair

Authorization is the header key for the Authorization. In Alteryx it is the field name you attach with to the download tool to provide the authorization. In your case it should say FieldName === Authorization . Value ="Bearer ${your token}" ---> that section replace the value in Authorization with the new value (and Bearer as a prefix). It should then return it to the main workflow. 

 

Regarding the rest ---> without seeing the workflow -> I can't answer this. Does the excel sheet keep track of the refresh tokens? the times of the refresh token? Is there a point in the workflow later which reads it in? Is there a max number of refresh tokens in a given time? Who knows? ---> there is probably a logic since while I might not build the workflow -> It seems reasonably well designed.

 

Your core issue is 'why doesn't it work' ---> to get to that you'll need to inspect the error messages in the download data. 

 

I see a lot of people complain about inherited workflows -> yes. they can suck. Yes. they can be a pain. but this is equivalent to inherriting a code base for anything. You have to dig into it to understand it -> and Alteryx as a system is pretty rough for comments.

digeorgiok
6 - Meteoroid

Thank you so much for the details. This information helped a lot. I believe I understand the issue now, and I’m wondering what the best solution might be.

 

It appears there was no failure test set up for the refresh token. If the previous refresh token API crashes and returns no token (null), that null value gets stored. If the workflow hasn’t been run in over two hours (the token’s expiration window), it will still try to run using an expired token. There’s currently no check for the expiration time in the workflow.

 

Do you think I need to store the time when the refresh token was last retrieved and check if more than two hours have passed before running the workflow again? The same goes for checking if the token is null. If Yes to this how do i solve the issue below?

 

How should I automate getting a new refresh token if the previously stored one is expired? Right now, we’re manually visiting the API link and entering our account number to obtain a new refresh token. How can I automate this process in Alteryx?

apathetichell
19 - Altair

I would have architected so the entire api call in a macro which called another macro to refresh the token if the initial call expired. I'd use that logic and branch out. you can also try to capture the expiration time in the refresh token return and convert it to datetime. Eitherway -> you'll need some macro/branch logic for refresh processing.

Labels
Top Solution Authors