# OAuth and Wordpress

**URL:** <https://community.hubspot.com/t/oauth-and-wordpress/69017>\
**Category:** APIs & Integrations\
**Tags:** php, oauth\
**Created:** [November 10, 2022, 3:09pm UTC](https://community.hubspot.com/t/oauth-and-wordpress/69017 "2022-11-10T15:09:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DWorktextile](https://avatars.discourse-cdn.com/v4/letter/d/dec6dc/32.png) [@DWorktextile](https://community.hubspot.com/u/DWorktextile)\
**Post date:** [November 10, 2022, 3:09pm UTC](https://community.hubspot.com/t/oauth-and-wordpress/69017/1 "2022-11-10T15:09:38Z")

</div>

Hi,  
I need to implement the OAuth on a wordpress website.  
I have the differents elements like Client\_id and Secret\_Id. But each time I Do a call to create the OAuth connetion my Wordpress site crash.

```lia-code-sample
<?php
 require_once __DIR__.'/vendor/autoload.php';

 use SevenShores\Hubspot\Resources\OAuth2;
 use SevenShores\Hubspot\Http\Client;

 define("CLIENT_ID", 'CLIENT_ID');
 define("CLIENT_SECRET", 'CLIENT_SECRET');
 define("REDIRECT_URI", 'REDIRECT_URI');

 $myClient = new Client(['key' => CLIENT_SECRET]);
 $myOAuth = new OAuth2($myClient);

 if (!isset($_GET['code'])) {

 $authorizeLink = $myOAuth->getAuthUrl(CLIENT_ID, REDIRECT_URI, $scope);
 echo "<a href='$authorizeLink'>Click to Authorize</a><BR>";
 exit;
 }
?>

```

I have done this code but It crash at the use and at require\_once

---

<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:** [November 15, 2022, 5:52pm UTC](https://community.hubspot.com/t/oauth-and-wordpress/69017/2 "2022-11-15T17:52:39Z")

</div>

Hey, @DWorktextile 👋 Can you tell the community more about your goal? It’s not 100% clear what you’re trying to accomplish with OAuth in this context.

- Have you created an app in a HubSpot developer account?
- Set up OAuth for your app?
- Are you trying to connect your app via OAuth?

Thank you.

Jaycee

---

<div class="post-metadata">

**Author:** ![DWorktextile](https://avatars.discourse-cdn.com/v4/letter/d/dec6dc/32.png) [@DWorktextile](https://community.hubspot.com/u/DWorktextile)\
**Post date:** [November 16, 2022, 2:15pm UTC](https://community.hubspot.com/t/oauth-and-wordpress/69017/3 "2022-11-16T14:15:22Z")

</div>

I need to implement it to remove the apiKey.  
We have create an app on our HubSpot developer account.  
The main problem is to set up and trying to connect my app via OAuth on our Wordpress.
