The Blog

Uncategorized

JQuery and JWT Ajax Authentication

Posted on


//JQuery falovered , adds the Authorization headers to each Ajax request - I store them in local storage
$.ajaxPrefilter(function( options ) {
if (options.beforeSend) {
options.beforeSend = function (xhr) {
xhr.setRequestHeader('Authorization', 'Bearer '+localStorage.getItem('token'));
}
}
});

Posted in Uncategorized 1 Comment

Persistent connect to additional MySQL in a clever way.

Posted on


# create ssh key
ssh-keygen

# copy ssh key to the mysql source server
ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected] -p 2222

# use this to test ssh connection
ssh [email protected] -p 2222

# here we make persistent connection to the source DB by changing DB port
ssh -fNg -L 3307:127.0.0.1:3306 [email protected] -p 2222

# and here we make the connection!
mysql -h 127.0.0.1 -P 3307 -u root -p some_db_on_source_server

Posted in Uncategorized Leave a comment
« Previous PageNext Page »