Fixed: Return error when Slack auth fails to help with debugging

This commit is contained in:
Tom Moor 2019-03-13 23:22:12 -07:00
parent a7d49e9042
commit f80c3c6877

View File

@ -29,8 +29,12 @@ router.get('slack.callback', auth({ required: false }), async ctx => {
ctx.assertPresent(code || error, 'code is required');
ctx.assertPresent(state, 'state is required');
if (state !== ctx.cookies.get('state') || error) {
ctx.redirect(`/?notice=auth-error`);
if (state !== ctx.cookies.get('state')) {
ctx.redirect('/?notice=auth-error');
return;
}
if (error) {
ctx.redirect(`/?notice=auth-error&error=${error}`);
return;
}