# Refresh Creator's Access Token - I'm failing

**URL:** <https://www.patreondevelopers.com/t/refresh-creators-access-token-im-failing/1091>\
**Category:** API Feedback\
**Created:** [August 28, 2018, 7:44am UTC](https://www.patreondevelopers.com/t/refresh-creators-access-token-im-failing/1091 "2018-08-28T07:44:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Meffesino](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Meffesino](https://www.patreondevelopers.com/u/Meffesino)\
**Post date:** [August 28, 2018, 7:44am UTC](https://www.patreondevelopers.com/t/refresh-creators-access-token-im-failing/1091/1 "2018-08-28T07:44:19Z")

</div>

Dear Team,  
I’m failing to update my creators access token as per [Step 7 - Keeping up to date](https://docs.patreon.com/#step-7-keeping-up-to-date) via Node.js. I always get a

> ```
> status: '405',
> title: 'Method Not Allowed' 
> 
> ```

as response.

This is the code:

```
var CLIENT_ID = '<clientid>'
var CLIENT_SECRET = '<secret>'
token = '<actual CREATORS TOKEN>' 
refresh_Token ='<refresh token>' //

url = 'https://www.patreon.com/api/oauth2/token'
options = {
    method: 'POST',
  headers:
   { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
     'User-Agent': 'my bot' },
  body:
   `client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}&refresh_token=${refresh_Token}&grant_type=refresh_token`,
   params:
   { client_id: CLIENT_ID,
     client_secret: CLIENT_SECRET,
     refresh_token: refresh_Token,
     grant_type: 'refresh_token'},
  credentials: 'include',
  compress: false 
}
request.get(url, options, function (e, r, body) {
(...)
}

```

Any idea?  
I tried to use the normal client token process for this, but I guess it has to look differently for the creators token, but I’m not sure…

Thanks!  
Meffesino

---

<div class="post-metadata">

**Author:** ![Meffesino](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Meffesino](https://www.patreondevelopers.com/u/Meffesino)\
**Post date:** [August 28, 2018, 8:53am UTC](https://www.patreondevelopers.com/t/refresh-creators-access-token-im-failing/1091/2 "2018-08-28T08:53:23Z")

</div>

OK. i figured it out by myself. First of all, I had done  
`request.get` while the mothod was (correctly) stated as “post”.

secondly, the body has to be created a bit differently.

here you go:

```
var CLIENT_ID = '<ID>'

var CLIENT_SECRET = '<SECRET>'

var token = '<Token- NOT NEEDED FOR REFRESH TOKEN>' 

var refresh_Token =<REFRESH TOKEN>' //

var form = {
    grant_type: 'refresh_token',
    client_id: CLIENT_ID,
    client_secret: CLIENT_SECRET,
    refresh_token: refresh_Token
}

var formData = querystring.stringify(form);
var contentLength = formData.length;

request({
    headers: {
      'Content-Length': contentLength,
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    uri: 'https://www.patreon.com/api/oauth2/token',
    body: formData,
    method: 'POST'
  }, function (err, res, body) {
console.log(body)  
});
```
