# User role retrieval from /user/session

**URL:** <https://community.dreamfactory.com/t/user-role-retrieval-from-user-session/3448>\
**Category:** Authentication & Security\
**Created:** [November 18, 2016, 4:35pm UTC](https://community.dreamfactory.com/t/user-role-retrieval-from-user-session/3448 "2016-11-18T16:35:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![scmathew](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@scmathew](https://community.dreamfactory.com/u/scmathew)\
**Post date:** [November 18, 2016, 4:35pm UTC](https://community.dreamfactory.com/t/user-role-retrieval-from-user-session/3448/1 "2016-11-18T16:35:24Z")

</div>

login: function(email, password, callback) {  
//alert(“In login function”);  
$.ajax({  
dataType: ‘json’,  
contentType: ‘application/json; charset=utf-8’,  
url: INSTANCE\_URL + ‘/api/v2/user/session’,  
data: JSON.stringify({  
“email”: email,  
“password”: password  
}),  
cache:false,  
method:‘POST’,  
success:function (response) {  
callback(response);  
},  
error:function (response) {  
callback(response);  
return false;  
}  
});  
},

On the api-docs feature the response properly loads the response.role and response.role\_id properly but when I try to access the response.role and response.role\_id in a seperate .js file both fields seem to be undefined.
