我已经从 github https://github.com/chriskacerguis/codeigniter-restserver下载了 CodeIgniter Rest Server 源代码。
我已经按照自述文件进行了集成,但是当我调用 htttp://www.sitename.com:81/api/key/index 来生成第一次新密钥时,我收到“无效 API 密钥”错误和 403 Forbidden 错误并存入数据库。
屏幕截图 1:查看 FF 浏览器以及 Google Chrome Windows 7 - 64 位中使用的 POSTMAN 扩展中出现的错误截图
下面是我的 Rest.php 中的代码 >>>>>
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$config['force_https'] = FALSE;
$config['rest_default_format'] = 'json';
$config['rest_supported_formats'] = ['json','array','csv','html','jsonp','php','serialized','xml'];
$config['rest_status_field_name'] = 'status';
$config['rest_message_field_name'] = 'error';
$config['enable_emulate_request'] = TRUE;
$config['rest_realm'] = 'REST API';
$config['rest_auth'] = FALSE;
$config['auth_source'] = ''; //i set it as none/blank, default value set as 'ldap'
$config['auth_library_class'] = '';
$config['auth_library_function'] = '';
$config['rest_valid_logins'] = ['admin' => '1234'];
$config['rest_ip_whitelist_enabled'] = FALSE;
$config['rest_ip_whitelist'] = '';
$config['rest_ip_blacklist_enabled'] = FALSE;
$config['rest_ip_blacklist'] = '';
$config['rest_database_group'] = 'default';
$config['rest_keys_table'] = 'keys';
$config['rest_enable_keys'] = TRUE; //i set it as TRUE default value is FALSE
$config['rest_key_column'] = 'key';
$config['rest_limits_method'] = 'ROUTED_URL';
$config['rest_key_length'] = 40;
$config['rest_key_name'] = 'X-API-KEY';
$config['rest_enable_logging'] = TRUE;//i set it as TRUE default value is FALSE
$config['rest_logs_table'] = 'logs';
$config['rest_enable_access'] = FALSE;
$config['rest_access_table'] = 'access';
$config['rest_logs_json_params'] = FALSE;
$config['rest_enable_limits'] = FALSE;
$config['rest_limits_table'] = 'limits';
$config['rest_ignore_http_accept'] = FALSE;
$config['rest_ajax_only'] = FALSE;
$config['rest_language'] = 'english';
routes.php 中的代码 >>
$route['api/key/index'] = 'api/key/index'; // Generate First Time Key
谁能指导我如何为 CI 休息服务器生成这个第一次密钥?
如果有人尽快为这个问题提供解决方案,这将非常有帮助,因为我自 2 天以来一直试图解决它以找到解决方案但没有取得任何成功。:(