I have created an anchor tag in first page,
<div><a target="_blank" href="/secondPAge">Redirect to secong page</div>
Also defined a new path in my routes file like this,
app.get('/firstPage', addon.authenticate(), function(req, res) {
res.setHeader('Access-Control-Allow-Origin','*');
res.render('firstPage', { title: "First Page" });
});
app.get('/secondPage', addon.authenticate(), function(req, res) {
res.setHeader('Access-Control-Allow-Origin','*');
res.render('secondPage', { title: "Second Page" });
});
When I remove addon.authenticate() the page gets redirected, else throws error - "Unauthorized: Could not find authentication data on request". Have added the page references in atlassian-connect.json as,
"modules": {
"generalPages": [
{
"key": "myaddonkeyfirstpage",
"location": "system.top.navigation.bar",
"name": {
"value": "FirstPage"
},
"url": "/firstPage",
"conditions": [{
"condition": "user_is_logged_in"
}]
},
{
"key": "myaddonkeysecondpage",
"location": "none",
"name": {
"value": "SecondPage"
},
"url": "/secondPage",
"conditions": [{
"condition": "user_is_logged_in"
}]
}
]
}
Can I load page using link in anchor tag? Or how to redirect to another page from first page with authentication?