In our connect add-on, have added the same code. But cannot access the data, as 401 error code is thrown when using addon.checkValidToken(). Here is my server side code,
app.get('/test', addon.checkValidToken(), function(req, res){
....
});
and client side code,
$.ajax({
type: "GET",
url: "/test",
dataType: "json",
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization", "JWT {{token}}");
},
success: function(data){
alert("success");
}
});
Already, I have posted a question here. What changes has to be done here? Or how can I check jwt token using checkValidToken(). Thanks in advance.