/** * Call namespaces */ use App\ServiceBgl360; use App\AuthenticationBgl360; use App\ResourceRequestBgl360; use App\Time; /** * Declare local and global variables */ global $wpdb; /** * Instantiate classes */ $service_bgl360 = new ServiceBgl360($wpdb, $current_user->ID); $authentication_bgl360 = new AuthenticationBgl360(); $resource_request_bgl360 = new ResourceRequestBgl360(); $time = new Time(); /** * Set up authentication data */ //echo "this is authentication page <br>"; $clientId = 'f937a03e-db37-4213-9d37-9484e7eab33d'; $clientSecret = '9a88e4bc-ab1c-41b3-a8b3-a5f7b32502de'; $basicAuthorizationHeader = 'ZjkzN2EwM2UtZGIzNy00MjEzLTlkMzctOTQ4NGU3ZWFiMzNkOjlhODhlNGJjLWFiMWMtNDFiMy1hOGIzLWE1ZjdiMzI1MDJkZQ=='; $authentication_bgl360->setRedirectUrlToAuthorizationPage("https://api.bgl360.com.au/oauth/authorize?response_type=code&client_id={$clientId}&scope=investment&redirect_uri=https://app.thesmsfacademy.com.au/wp-bgl360-authenticate.php"); $authentication_bgl360->setMainUri('https://api.bgl360.com.au/oauth/token'); $authentication_bgl360->setAuthorizationCode($authentication_bgl360->getAuthorizationCode()); $authentication_bgl360->setGrantType('authorization_code'); $authentication_bgl360->setScope('investment'); $authentication_bgl360->setClientId($clientId);
/** * Call namespaces */ use App\ServiceBgl360; use App\AuthenticationBgl360; use App\ResourceRequestBgl360; use App\Time; /** * Declare local and global variables */ global $wpdb; /** * Instantiate classes */ $service_bgl360 = new ServiceBgl360($wpdb, $current_user->ID); $authentication_bgl360 = new AuthenticationBgl360(); $resource_request_bgl360 = new ResourceRequestBgl360(); $time = new Time(); /** * Set up authentication data */ $authentication_bgl360->setRedirectUrlToAuthorizationPage("https://api-staging.bgl360.com.au/oauth/authorize?response_type=code&client_id=5dbf9b2c-981f-44e4-8212-d3b5c74795a1&scope=investment&redirect_uri=https://app.thesmsfacademy.com.au/bgl360-authenticate.php"); $authentication_bgl360->setMainUri('https://api-staging.bgl360.com.au/oauth/token'); $authentication_bgl360->setAuthorizationCode($authentication_bgl360->getAuthorizationCode()); $authentication_bgl360->setGrantType('authorization_code'); $authentication_bgl360->setScope('investment'); $authentication_bgl360->setClientId('5dbf9b2c-981f-44e4-8212-d3b5c74795a1'); $authentication_bgl360->setClientSecret('b5a0ff39-ef93-4bc7-b5de-e0ace2d7a6fc'); $authentication_bgl360->setRedirectUri('https://app.thesmsfacademy.com.au/bgl360-authenticate.php'); $authentication_bgl360->setAccessTokenUri($authentication_bgl360->getAccessTokenUri()); if ($service_bgl360->isExistAccessToken()) {
echo 'User email: ' . $current_user->user_email . '<br />'; echo 'User first name: ' . $current_user->user_firstname . '<br />'; echo 'User last name: ' . $current_user->user_lastname . '<br />'; echo 'User display name: ' . $current_user->display_name . '<br />'; echo 'User ID: ' . $current_user->ID . '<br />'; // require "bgl360/app/Http/ServiceBgl360.php"; require "bgl360/app/Http/AuthenticationBgl360.php"; require "bgl360/app/Http/ResourceRequestBgl360.php"; // use App\ServiceBgl360; use App\AuthenticationBgl360; use App\ResourceRequestBgl360; global $wpdb; $service_bgl360 = new ServiceBgl360($wpdb, $current_user->ID); $authentication_bgl360 = new AuthenticationBgl360(); $resource_request_bgl360 = new ResourceRequestBgl360(); //Authentication set up $authentication_bgl360->setMainUri('https://api-staging.bgl360.com.au/oauth/token'); $authentication_bgl360->setAuthorizationCode($authentication_bgl360->getAuthorizationCode()); $authentication_bgl360->setGrantType('authorization_code'); $authentication_bgl360->setScope('investment'); $authentication_bgl360->setClientId('5dbf9b2c-981f-44e4-8212-d3b5c74795a1'); $authentication_bgl360->setClientSecret('b5a0ff39-ef93-4bc7-b5de-e0ace2d7a6fc'); $authentication_bgl360->setRedirectUri('https://app.thesmsfacademy.com.au/wp-bgl360-landing.php'); $authentication_bgl360->setAccessTokenUri($authentication_bgl360->getAccessTokenUri()); echo "Access Token Uri " . $authentication_bgl360->getAccessTokenUri() . '<br>'; //Insert new access token to database print insert token status //if($service_bgl360->insertNewAccessToken(array('access_token'=>'123123', 'refresh_token'=>'sadasdasd', 'expires_in'=>'123123', 'scope'=> 'investment'))){ // echo "inserted <br>"; //} else {