PluginProbe
HubSpot All-In-One Marketing – Forms, Popups, Live Chat / 11.0.7
HubSpot All-In-One Marketing – Forms, Popups, Live Chat v11.0.7
11.3.75 11.3.73 11.3.71 11.3.70 11.3.69 11.3.64 11.3.65 11.3.62 11.3.61 11.3.56 11.3.58 11.0.31 11.0.52 11.0.54 11.0.56 11.0.58 11.0.7 11.1.10 11.1.11 11.1.13 11.1.14 11.1.15 11.1.2 11.1.20 11.1.21 All 73 releases
leadin / public / modules / api / class-oauth-api-controller.php

class-oauth-api-controller.php in HubSpot All-In-One Marketing – Forms, Popups, Live Chat 11.0.7, at public/modules/api/class-oauth-api-controller.php

40 lines 809 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Leadin\api;
4
5 use Leadin\api\Base_Api_Controller;
6 use Leadin\client\Access_Token_Api_Client;
7 use Leadin\auth\OAuth;
8 use Leadin\auth\OAuthCrypto;
9 use Leadin\data\Portal_Options;
10
11 /**
12 * OAuth controller endpoint
13 */
14 class OAuth_Api_Controller extends Base_Api_Controller {
15
16 /**
17 * Class constructor, register route.
18 */
19 public function __construct() {
20 self::register_leadin_route(
21 '/refresh-token',
22 \WP_REST_Server::READABLE,
23 array( $this, 'get_refresh_token' )
24 );
25 }
26
27 /**
28 * Make an API request to validate the HubSpot access token and return the scopes.
29 */
30 public function get_refresh_token() {
31 $refresh_token = OAuth::get_refresh_token();
32 $return_body = array(
33 'refreshToken' => $refresh_token,
34 );
35
36 return new \WP_REST_Response( $return_body, 200 );
37 }
38
39 }
40