Search code examples
expressstormpathexpress-stormpath

stormpath logout URL route not working


I see this error message "Cannot GET /logout" for the /logout URL, but from the docs it seems like that link should automatically be registered as a route. My code is very basic at the moment, looks like:

var express = require("express");
var stormpath = require('express-stormpath');

var app = express();
var port = 1337;

app.use(stormpath.init(app, {
    apiKey: {
        id: '<>',
        secret: '<>'
    },
    application: {
        href: "<>"
    },
    website: true
}));

app.get("/", stormpath.loginRequired, function(req, res) {
    res.send("Hello Node.js and Express.");
});

app.on('stormpath.ready', function() {
  console.log('Stormpath Ready!');
});

console.log("Web application opened.");
app.listen(port);

Any help is much appreciated.


Solution

  • The logout route for express-stormpath requires a POST request. We do this to prevent the omnibar from accidentally logging you out from the application.