# leadin/11.0.7/public/modules/api/class-oauth-api-controller.php

HubSpot All-In-One Marketing – Forms, Popups, Live Chat, version 11.0.7. 40 lines.

- Page: https://pluginprobe.com/plugins/leadin/11.0.7/code/public/modules/api/class-oauth-api-controller.php
- Raw: https://pluginprobe.com/plugins/leadin/11.0.7/raw/public/modules/api/class-oauth-api-controller.php
- Modified: 2024-03-06T11:43:04+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/leadin/11.0.7/code/public/modules/api/class-oauth-api-controller.php#L10-L20`.

```php
<?php

namespace Leadin\api;

use Leadin\api\Base_Api_Controller;
use Leadin\client\Access_Token_Api_Client;
use Leadin\auth\OAuth;
use Leadin\auth\OAuthCrypto;
use Leadin\data\Portal_Options;

/**
 * OAuth controller endpoint
 */
class OAuth_Api_Controller extends Base_Api_Controller {

	/**
	 * Class constructor, register route.
	 */
	public function __construct() {
		self::register_leadin_route(
			'/refresh-token',
			\WP_REST_Server::READABLE,
			array( $this, 'get_refresh_token' )
		);
	}

	/**
	 * Make an API request to validate the HubSpot access token and return the scopes.
	 */
	public function get_refresh_token() {
		$refresh_token = OAuth::get_refresh_token();
		$return_body   = array(
			'refreshToken' => $refresh_token,
		);

		return new \WP_REST_Response( $return_body, 200 );
	}

}

```
