Dynamic Token In API Connector Authorization Header

Thanks to @ambroisedlg for the help on this one. He showed me how to pass a dynamic token in the API Connector to handle refresh tokens that change on a regular basis. For the benefit of others looking to do this, I’ll write the solution here:

When you’re setting up the call in the API Connector plugin, you can add an Authorization key in the header, but you’ll uncheck the “private” checkbox. Unchecking this private checkbox allows the value to be dynamic. You’ll need to have a value in this field in order to initialize the call, but if you use a dynamic value in your app, that dynamic value will override the value in the plugin setup used to initialize. See image below how the private box is unchecked. You can see also that the value is empty. it can’t be empty when initializing. You can leave the value there even after initializing, but the dynamic value will override it.

This other image below shows how when you uncheck the private checkbox, It shows a place in the editor to add the Authorization header value dynamically. So when it calls the API to get the data, it uses this dynamic token value (which refreshes on the API every 60 minutes). For testing i was pulling the token from the database, but I ended up saving it as a cookie and pulling it from there.

@duke.severn @cs1

8 Likes