我们已经开始使用JavaScript SDK测试JSON APi。我们在IE中设置了ADFS来进行身份验证,如果你打开浏览器窗口并在Yammer上访问我们的网络,这就像使用嵌入代码嵌入Yammer提要一样有效。
然而,我们遇到了JSON提要的问题-在所有浏览器中,除了IE,如果还没有登录,我们会得到登录提示,然后这将带我们通过,我们将看到提要,然而在IE中,我们得到拒绝访问的弹出。
我们已经将assets.yammer.com/assets/platform_js_sdk.js添加到ADFS中作为可识别的源代码
有没有其他人有问题,只是IE和身份验证通过ADFS?
提前感谢!丰富的
我们从Yammer API参考中获取了代码,并按如下方式使用它:
$scope.yammerRequest = function(){
yam.platform.request({
url: "messages/in_group/1312007.json?threaded=true",
//url: "messages.json?threaded=true",
//url: "messages.json?threaded=true", //this is one of many REST endpoints that are available
method: "GET",
success: function (data) {
//Angulars $scope getting lost when inside an external library
// so we need to find the controller, which we can use to get the $scope
//get the controller
var controllerElement = document.querySelector('[ng-controller=YammerFeedCtrl]')
//use angularjs to get the scope from the controller
var $scope= angular.element(controllerElement).scope();
//get the messages from the data
$scope.yammerfeed = data
$scope.convertDateStringsToDates($scope.yammerfeed)
$scope.loaded = true
//make sure we apply the changes so they are reflected to the GUI
$scope.$apply();
},
error: function (user) {
alert("There was an error with the request.");
}
});
}
var init = function () {
$scope.selectUser($scope.yammerUsers[0])
//all Javascript interaction need to be done via thier SDK
//login to yammer
//yam.platform.login()
//yam.connect.loginButton('#yammer-login', function (resp) { if (resp.authResponse) { document.getElementById('yammer-login').innerHTML = 'Welcome to Yammer!'; } });
// url: https://www.yammer.com/oauth2/access_token.json?client_id=[:client_id]&client_secret=[:client_secret]&code=[:code]
//check login status
yam.getLoginStatus(
function(response) {
if (response.authResponse) { //if logged in
//request massages from yammer
var controllerElement = document.querySelector('[ng-controller=YammerFeedCtrl]')
//use angularjs to get the scope from the controller
var $scope= angular.element(controllerElement).scope();
$scope.yammerRequest();
}
else {
//alert("not logged in")
//all Javascript interaction need to be done via thier SDK
//login to yammer
yam.platform.login(
function(response){
if (response.authResponse) {
//var controllerElement = document.querySelector('[ng-controller=YammerFeedCtrl]')
////use angularjs to get the scope from the controller
//var $scope= angular.element(controllerElement).scope();
//$scope.yammerRequest();
yam.getLoginStatus(
function(response) {
if (response.authResponse) {
yam.platform.request({
//url: "messages.json?threaded=true",
url: "messages/in_group/1312007.json?threaded=true",
//url: "messages.json?threaded=true", //this is one of many REST endpoints that are available
method: "GET",
success: function (data) {
//Angulars $scope getting lost when inside an external library
// so we need to find the controller, which we can use to get the $scope
//get the controller
var controllerElement = document.querySelector('[ng-controller=YammerFeedCtrl]')
//use angularjs to get the scope from the controller
var $scope= angular.element(controllerElement).scope();
//get the messages from the data
$scope.yammerfeed = data
$scope.convertDateStringsToDates($scope.yammerfeed)
$scope.loaded = true
//make sure we apply the changes so they are reflected to the GUI
$scope.$apply();
},
error: function (data, data1, data2) {
alert(data.statusText);
}
});
}
});
哎呀-忘了发布答案- update2有解决方案的信息-只需要将所有内容放在同一个安全区域
我已经为这个问题绞尽脑汁好几天了,当你看到它是多么容易解决的时候,你会发疯的。你必须:
- 打开ie浏览器
- 按"Alt"键调出工具栏
- 选择"工具"
- 选择"Internet选项"
- 选择"安全"选项卡
- 选择"可信站点",然后点击"站点"按钮
- 将www.yammer.com添加到 区域
应该可以。