# Change node credentials at runtime

**URL:** https://discourse.nodered.org/t/change-node-credentials-at-runtime/19590
**Category:** General
**Created:** [26 December 2019 09:07 UTC](https://discourse.nodered.org/t/change-node-credentials-at-runtime/19590 "2019-12-26T09:07:38Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![alexkn](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@alexkn](https://discourse.nodered.org/u/alexkn)
#### Post date: [26 December 2019 09:07 UTC](https://discourse.nodered.org/t/change-node-credentials-at-runtime/19590/1 "2019-12-26T09:07:38Z")

</div>

In my node I use an API with OAuth authentication.  
I save the refresh token in the node credentials.  
When the access token is refreshed, the API also returns a new refresh token.

How can I save the new refresh token in the credentials file at runtime?

I already tried it with RED.nodes.addCredentials (node.id, credentials);, but this does not change the credentials file.  
After a restart, the old refresh token is active again.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [26 December 2019 10:14 UTC](https://discourse.nodered.org/t/change-node-credentials-at-runtime/19590/2 "2019-12-26T10:14:18Z")

</div>

Hi @alexkn

There is a long standing issue on the backlog to help handle this scenario.

Currently the only way to save anything to the credentials store is via a deploy - not something nodes are allowed to trigger of their own accord.

Until someone figures out how best to handle this scenario your options are limited.
