ADAL.js和Yammer身份验证

时间:2016-05-24 15:21:42

标签: javascript azure yammer adal

我现在看起来与这个问题非常相似,现在活动很少: Yammer REST API: 401 Unauthorized when using Azure AD token and Yammer Delegated Permissions

使用Adal.JS我已成功检索多种服务的令牌,包括https://graph.windows.nethttps://graph.microsoft.net等。

但是,无论我如何尝试,我的端点都没有指定为:

function a(n)
{
    // keep track of all the cycles
    var total = [];

    // hold values for the current cycle
    var temp = [];

    // cycle sizes
    var cycleSizes = [3, 4];

    // index of the current cycle
    var currentCycleIndex = 0;

    // iterate through numbers
    for(var i = 0; i < n; ++i)
    {
        // push the value into the temp
        temp.push(i);

        // if the length of the temp array is the length we want for the current cycle then
        if(temp.length == cycleSizes[currentCycleIndex])
        {
            // save the cycle data
            total.push(temp);

            // reset the cycle
            temp = [];

            // change the cycle
            currentCycleIndex = currentCycleIndex ^ 1;
        }
    }

    return total;
}

a(9);

[
    [0, 1, 2],
    [3, 4, 5, 6],
    [7, 8]
];

a(17);

[
    [0, 1, 2],
    [3, 4, 5, 6],
    [7, 8, 9],
    [10, 11, 12, 13],
    [14, 15, 16],
];

将始终导致401 Unauthorized。有没有人遇到类似的问题并设法解决它?我无法从上述问题中的一个答案中禁用SSO。

2 个答案:

答案 0 :(得分:1)

正如评论中所提到的,最终的问题不是401 Unauthorized,而是缺少Access-Control-Allow-Origin标头,这意味着请求成功但在浏览器中被阻止。

与Microsoft联系后,确定通过ADAL.js进行身份验证时,当前未添加这些标头。建议客户立即使用Yammer JS SDK。

我们还建议尝试构建一个代理请求服务器,该服务器将转发客户端请求并在响应中提供必要的标头,我们目前正在探索。

答案 1 :(得分:0)

yammer网络必须映射到Office 365 for ADAL集成令牌,以便与Yammer API端点一起使用。如果用户可以使用其Office 365凭据成功登录Yammer,则可以确定您的网络映射已到位。

我怀疑你是这样的,因为你还在使用Yammer SSO,因为Yammer SSO与Yammer的Office 365登录是互斥的。

Yammer将在2016年12月1日弃用SSO,因此开始计划很快转换到Office 365身份可能会有所帮助。