简体   繁体   English

如何获取登录当前会话的用户的ID?

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

I need to find the user who is logged into the current session. 我需要找到登录当前会话的用户。 I tried the following but does not work: Can anyone help me? 我尝试了以下但不起作用:任何人都可以帮助我吗? Thanks in advance! 提前致谢!

$.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);
    }
});

I tried the following and it works for me. 我尝试了以下内容,它适用于我。

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项目,你要求吗?

The REST call that you are making requires that you have a SESSION token. 您正在进行的REST调用要求您拥有SESSION令牌。 Normally, we will setup a REST user on our CRM's that can be accessed via REST. 通常,我们将在我们的CRM上设置一个REST用户,可以通过REST访问。

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

相关问题 Shopify:在 JavaScript 中获取当前登录的用户 ID - Shopify: get current logged in user ID in JavaScript mongodb如何获取当前登录用户 - mongodb how to get current logged in user 如何在react js中获取当前登录用户 - How to get current logged in user in react js Django:如何在 javascript 中访问当前登录用户的 ID? - Django : How to access current logged in user's id in javascript? 如何找到使用jwt“登录”的当前用户的ID? 我正在尝试发出GET请求并按特定ID进行过滤 - How do I find the id of the current user that is “logged in” with a jwt? I am trying to make a GET request and filter by specific id 在volusion平台中,如果用户已登录,如何获取客户ID - How to get the customer id if user is logged in , in volusion platform 用于获取当前登录用户的 Keycloak JavaScript API - Keycloak JavaScript API to get current logged in user 让当前用户登录 Keycloak 的最简单方法 - Simplest way to get current user logged in Keycloak 如何在 sap ui5 中将组合框默认值设置为会话登录用户 ID - how to set combo box default value as session logged in user id in sap ui5 如何通过在 cookie 中插入用户 ID 来保持 session 登录? - How can I keep the session logged in by inserting the user id inside a cookie?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM