我在codeigniter-restserver中遇到了身份验证问题。
当我将config:$config['rest_auth']设置为basic或digest时,我似乎无法使用标准登录通过验证。
还有什么我需要考虑的吗?
发布于 2013-01-12 04:32:22
我认为您必须在/application/config/rest.php中填充允许的用户名和密码:
$config['rest_valid_logins'] = array('user1' => 'password');发布于 2020-10-17 20:52:28
对于basic,您需要在/application/config/rest.php中将rest_auth转到basic
$config['rest_auth'] = 'basic';
然后在同一个文件中设置用户名和密码,为此,请转到/application/config/rest.php中的rest_valid_logins configuration,将密钥设置为用户名,并将密码设置为该密钥的值。请记住,它是一个关联数组,因此您可以使用多个值键对。
$config['rest_valid_logins'] = ['admin' => '1234'];
然后使用HTTP基本身份验证进行呼叫。为此,请使用以下格式:https://username:password@domain/path/to/api
例如,它可以是https://admin:1234@localhost/api/users
https://stackoverflow.com/questions/12459677
复制相似问题