/app.log Secret
Created
July 31, 2018 12:06
Auth0 Authentication Problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[2018-07-31T11:58:46.083Z] DEBUG: app/1 on app: ***.***.***.*** ==[GET]==> /auth/callback?code=****************&state=************************ | |
[2018-07-31T11:58:46.084Z] DEBUG: app/1 on app: Processing callback... | |
[2018-07-31T11:58:46.130Z] DEBUG: app/1 on app: ***.***.***.*** ==[GET]==> /auth/fail | |
[2018-07-31T11:58:46.131Z] WARN: app/1 on app: Problem authenticating user. (error=[]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const express = require("express"); | |
const passport = require("passport"); | |
const config = require("../config"); | |
const router = express.Router(); | |
router.get("/", passport.authenticate("auth0", { | |
clientID: config.auth0.clientID, | |
domain: config.auth0.domain, | |
redirectUri: config.auth0.callbackURL, | |
audience: `https://${config.auth0.domain}/userinfo`, | |
responseType: "code", | |
scope: "openid email profile", | |
}), (req, res) => { | |
req.app.locals.log.debug("Successful login"); | |
res.redirect("/"); | |
}); | |
router.get("/logout", (req, res) => { | |
req.logout(); | |
req.app.locals.log.debug("Successful logout"); | |
res.redirect("/"); | |
}); | |
router.get("/callback", (req, res, next) => { | |
req.app.locals.log.debug("Processing callback..."); | |
next(); | |
}, passport.authenticate("auth0", { | |
failureRedirect: "/auth/fail", | |
failureFlash: true, | |
}), (req, res) => { | |
req.app.locals.log.debug("Called back from Auth0"); | |
res.redirect(req.session.returnTo || "/"); | |
}); | |
router.get("/fail", (req, res) => { | |
req.app.locals.log.warn({error: req.flash("error")}, "Problem authenticating user."); | |
res.render("message", { | |
title: "Login Failure", | |
message: "There was a problem logging you in. Perhaps the authorization code expired or something else. You could try again or contact support if the problem persists.", | |
buttonText: "Try again", | |
buttonHref: "/auth", | |
}); | |
}); | |
module.exports = router; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment