# Setting Up OAuth using PHP

**URL:** <https://community.hubspot.com/t/setting-up-oauth-using-php/18607>\
**Category:** APIs & Integrations\
**Tags:** oauth\
**Created:** [February 6, 2020, 3:03pm UTC](https://community.hubspot.com/t/setting-up-oauth-using-php/18607 "2020-02-06T15:03:40Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Willson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/willson/32/84663_2.png) [@Willson](https://community.hubspot.com/u/Willson)\
**Post date:** [February 6, 2020, 4:01pm UTC](https://community.hubspot.com/t/setting-up-oauth-using-php/18607/2 "2020-02-06T16:01:34Z")

</div>

Hi @michaelbarley

Unfortunately I would not be the best resource when it comes to navigating this via PHP but the step you’re referring to is in relation to the `code` which is passed as a URL parameter after the user has authenticated the integration.

When the OAuth URL is accessed, this will prompt the integration user to login to their portal and confirm the scope access, once this is done, the redirect will occur to the `redirct_uri` which will have the `code` appended to it. This will then need to be captured and used as part of the data in the request for the access and refresh tokens.

This could be captured by using something along the lines of:

> **[How to get parameters from a URL string in PHP? - GeeksforGeeks](https://www.geeksforgeeks.org/php/how-to-get-parameters-from-a-url-string-in-php/)**
>
> Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and...

For further assistance, I was able to find this thread that may assist:

[https://community.hubspot.com/t5/APIs-Integrations/Oauth-2-get-authorisation-code-from-php-curl/td-p/234529](https://community.hubspot.com/t5/APIs-Integrations/Oauth-2-get-authorisation-code-from-php-curl/td-p/234529)

Further to the above, I was able to find this resource for you:

> <https://github.com/HubSpot/hubspot-php/issues/147>
>
> Can you provide example code on how to use the library to authorize an app and r…efresh tokens using Oauth2?
> 
> Thanks.

I hope this helps!

---

_[View the full topic](https://community.hubspot.com/t/setting-up-oauth-using-php/18607)._
