簡體   English   中英

如何獲取登錄當前會話的用戶的ID?

[英]How to get the ID of the user who is logged into the current session?

我需要找到登錄當前會話的用戶。 我嘗試了以下但不起作用:任何人都可以幫助我嗎? 提前致謝!

$.get(CurrentServerAddress + '/service/v4/rest.php', {
    method: "get_user_id",
    input_type: "JSON",
    response_type: "JSON",
    rest_data:'"new_get_user_id":["session":"' + SugarSessionId + '"]'
}, function(data) {
    if (data !== undefined) {
        var userID = jQuery.parseJSON(data);
    }
});

我嘗試了以下內容,它適用於我。

var userID = '';
    $.get(CurrentServerAddress + '/service/v4/rest.php', {
        method: "get_user_id",
        input_type: "JSON",
        response_type: "JSON",
        rest_data: '[{"session":"' + SugarSessionId + '"}]'
    }, function(data) {
        if (data !== undefined) {
            userID = jQuery.parseJSON(data);
        }
    });
'authenticated_user_id'

據我所知,這是你應該尋找的會議中的糖crm項目,你要求嗎?

您正在進行的REST調用要求您擁有SESSION令牌。 通常,我們將在我們的CRM上設置一個REST用戶,可以通過REST訪問。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM