Get a new shortLivedToken after expiry

Is there a way to get a new shortLivedToken after one expires after the allotted 5 minutes window?

When my integration recipe action endpoint is called with a lot of items, I first place them on a queue with their respective shortLivedToken before executing each. Sometimes, for requests that are handled after their shortLivedToken has expired, I get a NOT_AUTHENTICATED error back from the monday graphql api.

Is there a way to request a new shortLivedToken or run a long running request with an authenticated token?

Thanks.

cc: @dipro @Matias.Monday @AlexSavchuk

Hello there @hellotimi ,

Matias here!

You can not get that shortLivedToken again unless someone uses the recipe again.

In this case, I believe you might need to use OAuth to get a permanent token.

I’ve been struggling to get oauth to work for me for hours even after going through the documentation.

Could you please point me to a code example I could look at to get it to work. Or maybe you could please make a loom showing it.

Thank you.

cc: @Matias.Monday

Hello there @hellotimi,

Sure! You can see an example here :smile:

Thank you @Matias.Monday. Let me try it and I’ll let you know how it goes.

Sounds like a plan @hellotimi !!

@Matias We’re facing the same issue as @hellotimi where users sometimes trigger our integration recipes on hundreds of items simultaneously.

From an end-user perspective, how does OAuth work? For example, does each user need to go through the OAuth every time they initiate an integration recipe? How do we initiate the OAuth flow when we can’t control the monday.com UI?

Sorry if my questions are stupid, but we’re desperate for a solution …

This is exactly what I was wondering also.

User does not need to go through oAuth every time. You can use this option that comes on the integration recipes setup page in your app.
image

When the user adds the automation for the first time, they will be navigated to oAuth flow, using the url you provide here. When a token is fetched, you can save that in the storage. After that, every time the automation runs, you can use to the shortLivedToken to access the storage and fetch the oAuth token.

You can see more here: Authorization URL

Makes perfect sense, @manishaghosh – thank you!

In this case, the shortLivedToken will be that of the user who created the integration recipe. How about if we need to run the integration as the user who triggered the recipe (say, by updating a status column)? Can we use the OAuth authorization of the user who created the recipe to fetch the shortLivedToken of the user who triggered the recipe? The triggering user may not necessarily have gone through the OAuth process.

Hello @samicaracand , ShortLivedToken will be generated for the triggering user irrespective of if they go through oAuth or not. You can then use this shortLivedToken to access the storage and fetch the previously stored token.

However, I am not entirely sure if this OAuth token (generated by user who has set up the recipe) , can be used by the triggering user to successfully complete the automation. That needs to be tested. Hope that helps.

1 Like

Thank you for your help!

1 Like