Пример #1
0
 public function authorize($type = "authorization")
 {
     switch ($type) {
         case "authorization":
             $url = Config::API_OAUTH . "Authorize/?response_type=code&client_id=" . ACCESS_KEY . "&redirect_uri=" . Config::REDIRCET_URI . "&state=" . md5(time()) . "&scope=" . $scope;
             Client::redirect($url);
             break;
         case "implicit":
             $url = Config::API_OAUTH . "Authorize/?response_type=token&client_id=" . ACCESS_KEY . "&redirect_uri=" . Config::REDIRCET_URI . "&state=" . md5(time()) . "&scope=" . $scope;
             Client::redirect($url);
             break;
         default:
             return array("code" => 1058, "error" => "Unsupported Grant Type", "error_description" => "Grant type \"client_credentialss\" not supported");
             break;
     }
 }