0

Is it secure to manipulate with auth token inside client side javascript over https ? I want to pass that token to websocket after login.

$.getJSON(
$SCRIPT_ROOT + '/jscript_get_auth_token',
{},
function(data)
{
    // Extract token from data then manipulate .. pass to function etc.
    token = data.result
});
se7en
  • 1

2 Answers2

1

your question title is different to the question in your post.

is it secure to get the token via JavaScript from the server - this depends on the server side validation method in place. assuming these are OK

manipulating the token in JavaScript and then sending to a web socket should be fine as long as server side validation is good.

Darragh
  • 1,102
  • 9
  • 15
0

If you only want to read additional data from the token (like JWT), it is no security threat. Since this part of the token is not even encrypted. If you want to expose some secret keys by hardcoding them or getting them from a web server to change and create a new token, that might be a subject of XSS and so on for example.

Ilya Chernomordik
  • 2,197
  • 1
  • 21
  • 36