var atoken;
	    $.ajax({
			  url: "<c:url value = '/api/oauth/token' />",
			  type: 'POST',
			  crossDomain: true,
		      async: false,
		      cache: false,
			  data: {
			    grant_type:'password',
			    username:'admin',
			    password:'admin'
			  },
			  success: function(token, status) {
				  //store.set('token', token);
				  atoken=token;
			  },
			  beforeSend: function (xhr) {
				 xhr.setRequestHeader ("Authorization", "Basic " + btoa("acme:acmesecret" ));
			  }

		});