Ejemplo n.º 1
0
 function test_static_authorize_url_with_state()
 {
     $client_id = 8998879;
     $redirect_uri = 'http://example.com/auth';
     $scope = 'ViewReports,CreateCampaigns,SendCampaigns';
     $state = 89879287;
     $expected_result = "https://api.createsend.com/oauth?client_id=8998879&redirect_uri=http%3A%2F%2Fexample.com%2Fauth&scope=ViewReports%2CCreateCampaigns%2CSendCampaigns&state=89879287";
     $result = CS_REST_General::authorize_url($client_id, $redirect_uri, $scope, $state);
     $this->assertIdentical($expected_result, $result);
 }
 /**
  * Get url for authentification on Instagram
  * @return string
  */
 protected function _getAuthUrl()
 {
     $url = CS_REST_General::authorize_url($this->_getClientId(), $this->_getAuthRedirectUri(), 'ImportSubscribers,ManageLists');
     return $url;
 }
<?php

require_once '../../csrest_general.php';
$client_id = 8998879;
$redirect_uri = 'http://example.com/auth';
$scope = 'ViewReports,CreateCampaigns,SendCampaigns';
$state = 'some state data';
$authorize_url = CS_REST_General::authorize_url($client_id, $redirect_uri, $scope, $state);
echo "Redirect your users to: " . $authorize_url . "\n<br />";