How to update a workflow node's credential?

Guys, I’m in doubt from what I’ve been testing, is it possible to update only 1 specific node of 1 workflow? or do I need to edit everything to edit just that node?

What I thought was the following, I’m using Hotmart, their credential is through an access_token that expires every 48 hours, I’m going to delete the old credential, create a new one and then update it in the workflow.

Hey @htnrodrigues,

I am not sure I follow, If you open a workflow you can just edit the one node in it and save it. Is there maybe more to this?

the workflow to generate the access_token is being done like this:

I manage to generate the access_token, but I need to change the credential id within another workflow. If I just delete and create a new one the credential id is not updated automatically in the workflow

when it arrives at the config_update_workflow node it stops

Hey @htnrodrigues,

Right that makes more sense, If you are you using the API then yes you would need to post the entire workflow to update the credential ID.

I’m not sure to perform the replace in the config_update_workflow node and also I don’t know how to send the Workflow Object when I send {{ $json }} it won’t either, what am I doing wrong here? can you help?

Hey @htnrodrigues,

I think I saw a post about this on Discord last night, You are converting a bunch of objects to a string which is why you are seeing the strange output you would first need to use the JSON.stringify() option then try the replace but you might be better off doing it in a code node so first doing the stringify, then your replace then return the object with JSON.parse() and use that in the workflow update.

If it was me though I would probably look to see if I can just use the Hotmart OAuth credentials with the Generic OAuth type then n8n will just take care of it for you and you won’t need to use this process.

@Jon, i will try to reproduce this solution that you suggested, about OAuth, Hotmart is removing this type of credential and some accounts are only able to access with the access_token, so this was the only solution that I could think of at the moment.

Is the Access Token not generated from OAuth anyway?