Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript moquiajax调用问题_Javascript_Ajax_Rest_Authentication_Moqui - Fatal编程技术网

Javascript moquiajax调用问题

Javascript moquiajax调用问题,javascript,ajax,rest,authentication,moqui,Javascript,Ajax,Rest,Authentication,Moqui,对Moqui的Rest调用在本地运行时出现问题。。。下面是示例html代码,错误为禁止REST访问no authz:User null未授权在REST路径/moqui/users上查看。在web控制台上,错误为403禁止 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>AJAX Test</title> <script src="https://a

对Moqui的Rest调用在本地运行时出现问题。。。下面是示例html代码,错误为禁止REST访问no authz:User null未授权在REST路径/moqui/users上查看。在web控制台上,错误为403禁止

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>AJAX Test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
</head>

<body>

<script>

$(document).ready(function() {
$.ajax({
type: "GET",
url: "http://localhost:8080/rest/s1/moqui/users",
headers: {  

            Accept: "application/json",
            Authorization : "Basic am9obi5kb2U6bW9xdWk="
        },

    contentType: "application/json"
    }).then(function(data) {
    console.log(data);
});
});

</script>
</body>
</html>

实体、服务、屏幕、RESTAPI等的所有工件操作都需要Moqui中的授权。有很多方法可以在批量ie继承的authz中进行配置,但每次操作都会检查授权

下面是一些示例XML,用于为ADMIN组中的所有用户授权整个mantle REST API。这也可以在系统应用程序中完成,该应用程序具有用户、用户组、authz等屏幕

<!-- Artifact group for all of the Mantle REST API via the mantle resource (the root resource) -->
<artifactGroups artifactGroupId="MANTLE_API" description="Mantle REST API (via root resource)">
    <artifacts artifactTypeEnumId="AT_REST_PATH" artifactName="/mantle" inheritAuthz="Y"/>
    <authz artifactAuthzId="MANTLE_API_ADMIN" userGroupId="ADMIN" authzTypeEnumId="AUTHZT_ALWAYS" authzActionEnumId="AUTHZA_ALL"/>
</artifactGroups>

在使用Moqui制作应用的书中有更多关于工件授权功能的通用文档,您可以在Moqui.org上下载PDF。尽管REST API功能比本书更新,因此尚未在本书中介绍,但与屏幕授权相同的模式适用于REST API。

我正在传递用户授权,但它仍然显示user null,另一方面,如果我使用curl,那么它就可以工作了……当使用chromerest客户机扩展时,API调用可以正常工作,但是为什么它不能使用AJAX调用呢。