繁体   English   中英

Angular JS- Dreamfactory-无法连接:403禁止错误

[英]Angular JS- Dreamfactory - Unable to connect : 403 Forbidden error

我在Amazon Cloud EC2 DSP 1.8.0上。

根据他们在AngularJS上的文档,这就是我声明常量的方式:-

angular.module('starter', ['ionic', 'starter.controllers', 'starter.services','**ngDreamFactory**'])
      .constant('DSP_URL', 'http://***-**-**-***-**.ap-southeast-1.compute.amazonaws.com/')
      .constant('DSP_API_KEY', 'sql')

上面的URL是ec2实例地址。

这是应用程序启动时在控制台中出现的错误:

- GET http://***-**-**-***-**.ap-southeast-1.compute.amazonaws.com/rest/api_docs 403 (Forbidden) 

undefined : undefined http://***-**-**-***-**.ap-southeast-1.compute.amazonaws.com/rest/api_docs

即使我尚未对DSP进行任何调用,也会出现上述错误,因此我认为它必须是进行此调用的框架。 我看到这个“ / rest / api_docs”正在被添加到作为Angular SDK的一部分添加的JS文件中。

只是为了确认我的DSP设置正确且URL正确,这是将其粘贴到浏览器中时得到的:

- http://***-**-**-***-**.ap-southeast-1.compute.amazonaws.com/rest/api_docs?app_name=sql

{
  "swaggerVersion":"1.2",
  "apiVersion":"1.0",
  "authorizations":{ 
      "apiKey": {
          "type":"apiKey",
          "passAs":"header"
       }
   },
"info": {
    "title":"DreamFactory Live API Documentation",
    "description":"",
    "contact":"support@dreamfactory.com",
    "license":"Apache 2.0",
    "licenseUrl":"http://www.apache.org/licenses/LICENSE-2.0.html"},
    "events":[ 
       "swagger.cache_cleared",
       "swagger.cache_rebuilt"
    ],
    "apis":[
       {
          "path":"/user",
          "description":"User session and profile"
       },
       {
          "path":"/system",
          "description":"System configuration"
       },
       {
          "path":"/db",
          "description":"Local database access"
       },
       {
          "path":"/email",
          "description":"Email utility access"
       },
       {
          "path":"/files",
          "description":"Local file storage access"
       },
       {
          "path":"/sql",
          "description":"Amazon RDS Sql"
       }
   ]
}

因此,我认为设置正确。

在DSP端:-1)我已经定义了一个角色“ Amazon RDS”,并赋予了该角色“ sql”服务访问权限。 另外,尝试授予系统访问权限。 还是行不通。 2)在Config内部的CORS访问中,我在主机中添加了*,并选择了所有HTTP动词并启用了它们。 3)选中“允许来宾用户”,还为来宾用户选择了角色“ Amazon RDS”。

因此,当我稍后在代码中进行此调用时:-DreamFactory.api.db.getRecords出现错误:

- TypeError: Cannot read property 'getRecords' of undefined

因为安装服务本身未正确实例化。 在这方面的任何帮助将是有帮助的。

403表示您无权访问该应用程序。 如果您尚未创建该应用程序,或者您的角色没有访问该应用程序的权限,则可能会发生这种情况。 查看此链接以获取更多信息。

http://community.dreamfactory.com/t/unable-to-access-dsp-from-angularjs-mobile-app/478/14

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM