Setting Cookies in InAppBrowser URL


Am trying to set a cookie for inappbrowser url after its opened in IONIC application using tough-cookie.But it’s not working.Can you please help me out. Below is my code:

var tough = require('tough-cookie');
var cookiejar = new tough.CookieJar();
'', function(err) {console.log("err"+err);});

No error but cookie not set

Using Cookie-Master

cordova.cookieMaster.setCookieValue('', 'cookie-agreed', 
 function() {
    console.log('A cookie has been set');
function(error) {
    console.log('Error setting cookie: '+error);

Getting error as cookieMaster of undefined.Tried cordova.plugins.cookieMaster also.Also tried window.plugins.cookieMaster.