小编Jas*_*e17的帖子

使用Javascript的REST API Salesforce OAuth

我的salesforce开发人员帐户中有一个应用程序,我希望我的用户可以从我正在构建的远程应用程序中访问该应用程序.我发现在允许用户访问salesforce数据之前,我必须先使用OAuth2.0来授权我的用户.目前我正在尝试使用salesforce上描述的用户名密码OAuth流程.

步骤1)我通过以下代码片段使用用户名和密码请求访问令牌

var password = 'userPassword' + 'securityToken'
$.ajax({
    type: 'GET',
    url: 'https://login.salesforce.com/services/oauth2/token',
    contentType: 'application/json',
    dataType: 'json',
    beforeSend: function(xhr) {
        xhr.setRequestHeader('grant_type','password'),
        xhr.setRequestHeader('client_id',  '<client_id_here>'),
        xhr.setRequestHeader('client_secret', '<client_secret_here'),
        xhr.setRequestHeader('username', 'username@location.com'),
        xhr.setRequestHeader('password', "password")
    },
    success: function(response) {
        console.log('Successfully retrieved ' + response);
        //Other logic here
    },
    error: function(response) {
        console.log('Failed ' + response.status + ' ' + response.statusText);
        //Other logic here
    }
});
Run Code Online (Sandbox Code Playgroud)

但是,我的请求失败了以下消息:

1) OPTIONS https://login.salesforce.com/services/oauth2/token 400 (Bad Request) 

2) XMLHttpRequest cannot load https://login.salesforce.com/services/oauth2/token. No 
  'Access- Control-Allow-Origin' header is present on …
Run Code Online (Sandbox Code Playgroud)

javascript ajax rest oauth salesforce

6
推荐指数
2
解决办法
7208
查看次数

发出加载谷歌地图与角js

我正在使用以下javascript将google地图加载到我的angular.js网络应用程序中.当我在页面上并刷新时,地图工作正常; 但是,当我从我的应用程序中的其他位置链接到页面时,地图不会加载.我相信这与DOM监听器没有注册"加载"事件有关,但是,我不确定.我很感激帮助解决这个问题.

authApp.controller('BarsController', function($scope, $rootScope, BarService) {
  $scope.currentUser = Parse.User.current();
  $scope.title = $rootScope.title;

  function initialize(){
      var mapOptions = {
          zoom: 11,
          mapTypeId: google.maps.MapTypeId.ROADMAP
      };

      var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);

      $scope.map = map;
      if(navigator.geolocation) {
          navigator.geolocation.getCurrentPosition(function(position) {
              var pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude)

              $scope.map.setCenter(pos);

              //Set myLocation Pin
              var marker = new google.maps.Marker({
                  position: pos,
                  map: $scope.map,
                  title: 'My Location',
                  icon: 'http://maps.google.com/mapfiles/ms/icons/green-dot.png'
              });

          }), function(error){
            console.log('Unable to get location: ' + error.message);
          };
      }
   }; 
   google.maps.event.addDomListener(window, 'load', initialize);
 });  
Run Code Online (Sandbox Code Playgroud)

解决方案由DMullings提供:

 authApp.controller('BarsController', …
Run Code Online (Sandbox Code Playgroud)

javascript jquery google-maps google-maps-api-3 angularjs

4
推荐指数
1
解决办法
1936
查看次数

firebase(延迟)动态链接匹配精度

我正在考虑在我的应用程序中使用 firebase 动态链接。我需要将唯一标识符从电子邮件生成的链接传递到用户应用程序中。当用户安装了应用程序时,这可以正常工作,但是,我对未安装应用程序的方式有些困惑。

我看到如果用户没有安装应用程序,firebase 动态链接支持将用户带到应用程序商店。然后,在安装应用程序后,他们使用(延迟?)链接将用户带入应用程序的深层链接目标。这是怎么做的?如何保证匹配?或者是吗?

Branch.io显著的文档对如何他们处理递延深层链接伴随着所有的战略和回退的,他们实现。firebase 动态链接是否依赖于相同的策略,或者他们是否有另一种机制来 100% 保证用户从深层链接到应用安装再到应用打开的匹配?

deep-linking firebase ionic-framework branch.io firebase-dynamic-links

3
推荐指数
1
解决办法
2228
查看次数

ionic pro package failure:无法安装android SDK Platform 26

我正在使用新的Ionic Pro.我已将以前工作的离子应用程序迁移到新的Pro服务中.我现在能够成功地将我的代码推送到我的离子pro git repo,我可以在仪表板上看到构建日志.构建成功完成.完成后,我导航到所述构建的"包"选项卡.我配置我的包以编译platform = Android version = Release Security Profile = Android Release安全配置文件.

此时的输出日志将在安装过程中移动,并获得以下控制台输出.

 BUILD SUCCESSFUL
Run Code Online (Sandbox Code Playgroud)

然后,构建过程似乎启动Gradle Daemon并最终以此输出结束

The Task.leftShift(Closure) method has been deprecated and is scheduled to 
be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at 
Run Code Online (Sandbox Code Playgroud)

无法加载文件/home/gitlab-runner/.android/repositories.cfg.在/ opt/android-sdk/licenses中检查包Android SDK平台26的许可证接受包Android SDK平台26的许可证.准备"安装Android SDK Platform 26".警告:无法读取或创建安装属性文件.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Failed to install the following SDK components:
  [Android SDK Platform 26]
  The SDK directory (/opt/android-sdk) …
Run Code Online (Sandbox Code Playgroud)

ionic-framework ionic2 ionic3

2
推荐指数
1
解决办法
2934
查看次数