add console.log to debug login issues

This commit is contained in:
Karol Wypchlo 2021-09-29 12:34:10 +02:00
parent 3310273968
commit 103009e43f
No known key found for this signature in database
GPG Key ID: C92C016317A964D0
3 changed files with 5 additions and 1 deletions

View File

@ -10,6 +10,8 @@ export default async (req, res) => {
res.setHeader("Set-Cookie", header["set-cookie"]); res.setHeader("Set-Cookie", header["set-cookie"]);
res.redirect(req.query.return_to ?? "/"); res.redirect(req.query.return_to ?? "/");
} catch (error) { } catch (error) {
console.log(`Cookie is present but authentication failed: ${error.message}`);
// credentials were correct but accounts service failed // credentials were correct but accounts service failed
res.redirect("/.ory/kratos/public/self-service/browser/flows/logout"); res.redirect("/.ory/kratos/public/self-service/browser/flows/logout");
} }

View File

@ -32,7 +32,7 @@ export async function getServerSideProps(context) {
throw new Error(`Failed to retrieve flow ${flow} with code ${status}`); throw new Error(`Failed to retrieve flow ${flow} with code ${status}`);
} catch (error) { } catch (error) {
console.log(error.message); // log failure message for debugging purpose console.log(`Unexpected error retrieving login flow: ${error.message}`);
return { return {
redirect: { redirect: {

View File

@ -35,6 +35,8 @@ export async function getServerSideProps(context) {
throw new Error(`Failed to retrieve flow ${flow} with code ${status}`); throw new Error(`Failed to retrieve flow ${flow} with code ${status}`);
} catch (error) { } catch (error) {
console.log(`Unexpected error retrieving registration flow: ${error.message}`);
return { return {
redirect: { redirect: {
permanent: false, permanent: false,