# PHP Hubspot client - Refresh token

**URL:** <https://community.hubspot.com/t/php-hubspot-client-refresh-token/95938>\
**Category:** APIs & Integrations\
**Tags:** php, oauth\
**Created:** [December 13, 2023, 2:40am UTC](https://community.hubspot.com/t/php-hubspot-client-refresh-token/95938 "2023-12-13T02:40:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![APerez35](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@APerez35](https://community.hubspot.com/u/APerez35)\
**Post date:** [December 13, 2023, 2:40am UTC](https://community.hubspot.com/t/php-hubspot-client-refresh-token/95938/1 "2023-12-13T02:40:18Z")

</div>

I’m fixing some things in a project where we’re using a PHP+Laravel backend and a Hubspot client to query the API. So for example to get deals we do this:

`$response = \HubSpot\Factory::createWithAccessToken($token)->crm()->deals()->basicApi()->getPage();`

But when trying to use the client to refresh the token there’s a problem, the method createToken doesn’t seem to exist.

`$refreshedToken = \HubSpot\Factory::create()->auth()->oAuth()->tokensApi()->createToken( 'refresh_token', null, $redirect_uri, $client_id, $client_secret, $refresh_token ); `

I couldn’t find documentation for this client, what’s the appropiate way to refresh tokens using it?

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [December 13, 2023, 8:56pm UTC](https://community.hubspot.com/t/php-hubspot-client-refresh-token/95938/2 "2023-12-13T20:56:20Z")

</div>

Hey, @APerez35 👋 Have you checked out the documentation here? — [Managing tokens](https://developers.hubspot.com/docs/api/oauth/tokens)

Best,

Jaycee

---

<div class="post-metadata">

**Author:** ![APerez35](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@APerez35](https://community.hubspot.com/u/APerez35)\
**Post date:** [December 14, 2023, 6:00pm UTC](https://community.hubspot.com/t/php-hubspot-client-refresh-token/95938/3 "2023-12-14T18:00:50Z")

</div>

Thanks, I hadn’t found that page before, this helped me solve the issue

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [December 14, 2023, 8:24pm UTC](https://community.hubspot.com/t/php-hubspot-client-refresh-token/95938/4 "2023-12-14T20:24:48Z")

</div>

Awesome! Have a fantastic day! — Jaycee
